chore: release 0.3.0 #22
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
tags: ["*"] | |
concurrency: | |
cancel-in-progress: true | |
group: ${{github.workflow}}-${{github.ref_name}} | |
jobs: | |
build: | |
runs-on: ${{matrix.os}} | |
name: Build ${{matrix.platform}} packages | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
platform: common | |
targets: publishKotlinMultiplatformPublicationToLocalRepository | |
- os: ubuntu-latest | |
platform: JVM | |
targets: publishJvmPublicationToLocalRepository | |
- os: ubuntu-latest | |
platform: Android | |
targets: publishAndroidReleasePublicationToLocalRepository | |
- os: ubuntu-latest | |
platform: JS | |
targets: publishJsPublicationToLocalRepository | |
- os: ubuntu-latest | |
platform: Linux | |
targets: >- | |
publishLinuxX64PublicationToLocalRepository | |
publishLinuxArm64PublicationToLocalRepository | |
- os: windows-latest | |
platform: Windows | |
targets: publishMingwX64PublicationToLocalRepository | |
- os: macos-14 | |
platform: macOS/iOS | |
targets: >- | |
publishMacosX64PublicationToLocalRepository | |
publishMacosArm64PublicationToLocalRepository | |
publishIosArm64PublicationToLocalRepository | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: gradle | |
cache-dependency-path: | | |
gradle/libs.versions.toml | |
gradle/wrapper/gradle-wrapper.properties | |
- name: Set up cross compilation | |
run: sudo apt-get install -qy {binutils,gcc}-aarch64-linux-gnu | |
if: matrix.platform == 'Linux' || matrix.platform == 'common' | |
- name: Get the cache versions | |
id: versions | |
shell: sh | |
run: |- | |
{ | |
sed -n 's/kotlin-stdlib = "\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)"/kotlin=\1.\2.\3/p' gradle/libs.versions.toml | |
} >> "$GITHUB_OUTPUT" | |
- name: Restore Kotlin/Native prebuilt | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{runner.tool_cache}}/konan/kotlin-native-prebuilt-* | |
key: konan-${{runner.os}}-prebuilt-${{steps.versions.outputs.kotlin}} | |
- name: Restore Kotlin/Native dependencies | |
uses: actions/cache/restore@v4 | |
if: matrix.platform != 'JVM' && matrix.platform != 'Android' && matrix.platform != 'JS' | |
with: | |
path: ${{runner.tool_cache}}/konan/dependencies | |
key: konan-${{runner.os}}-dependencies | |
- name: Build packages | |
run: ./gradlew --no-daemon ${{matrix.targets}} | |
env: | |
SIGNING_KEY: ${{secrets.SIGNING_KEY}} | |
SIGNING_PASSWORD: ${{secrets.SIGNING_PASSWORD}} | |
KONAN_DATA_DIR: ${{runner.tool_cache}}/konan | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: kbigint-${{matrix.platform == 'macOS/iOS' && 'macOS-iOS' || matrix.platform}} | |
path: | | |
build/repo/** | |
!build/repo/**/maven-metadata.* | |
retention-days: 2 | |
publish: | |
runs-on: ubuntu-latest | |
name: Publish packages on Maven Central | |
needs: [build] | |
environment: | |
name: sonatype | |
url: https://central.sonatype.com/artifact/io.github.observeroftime.kbigint/kbigint | |
env: | |
SONATYPE_API: https://central.sonatype.com/api/v1/publisher | |
SONATYPE_AUTH: "Authorization: Bearer ${{secrets.SONATYPE_TOKEN}}" | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: kbigint | |
pattern: kbigint-* | |
merge-multiple: true | |
- name: Upload bundle | |
run: |- | |
url="$SONATYPE_API/upload?name=kbigint-${GITHUB_REF_NAME}.zip&publishingType=USER_MANAGED" | |
(cd kbigint && zip -qr ../kbigint.zip *) | |
printf >> "$GITHUB_ENV" 'DEPLOYMENT_ID=%s\n' $(curl -Ssf [email protected] -H "$SONATYPE_AUTH" "$url") | |
- name: Verify status | |
timeout-minutes: 5 | |
run: |- | |
url="$SONATYPE_API/status?id=$DEPLOYMENT_ID" | |
while [[ ${state:=PENDING} == PENDING ]] || [[ $state == VALIDATING ]]; do | |
state=$(curl -Ssf -XPOST -H "$SONATYPE_AUTH" "$url" | jq -r .deploymentState) | |
done | |
if [[ $state == FAILED ]]; then | |
printf '::error title=Publication failed::Check https://central.sonatype.com/publishing/deployments\n' | |
exit 1 | |
fi | |
- name: Publish deployment | |
run: curl -fi -XPOST -H "$SONATYPE_AUTH" "$SONATYPE_API/deployment/$DEPLOYMENT_ID" | |
release: | |
runs-on: ubuntu-latest | |
name: Create GitHub release | |
needs: [publish] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate changelog | |
uses: orhun/git-cliff-action@v3 | |
id: cliff | |
with: | |
args: -v --current | |
config: .github/cliff.toml | |
env: | |
OUTPUT: changes.md | |
GITHUB_TOKEN: ${{github.token}} | |
GITHUB_REPO: ${{github.repository}} | |
- name: Create release | |
run: gh release create $GITHUB_REF_NAME -F '${{steps.cliff.outputs.changelog}}' | |
env: | |
GH_TOKEN: ${{github.token}} | |