-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# What's in this pull request - resolved #126
- Loading branch information
Showing
5 changed files
with
116 additions
and
72 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Release (Android) | ||
|
||
on: | ||
workflow_run: | ||
workflows: [ "Release" ] | ||
types: [ completed ] | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
release-android: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Cargo.toml to check version | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
Cargo.toml | ||
sparse-checkout-cone-mode: false | ||
- name: Get rusaint version | ||
id: current_version | ||
run: yq '.workspace.package.version | "result=" + .' Cargo.toml >> $GITHUB_OUTPUT | ||
- name: Check current version is published in Maven central | ||
id: is_published | ||
run: | | ||
MAVENCENTRAL_TOKEN=$(echo "${{ secrets.MAVENCENTRAL_USERNAME }}:${{ secrets.MAVENCENTRAL_PASSWORD }}" | base64) | ||
curl -L \ | ||
-H "Accept: application/json" \ | ||
-H "Authorization: Bearer $MAVENCENTRAL_TOKEN" \ | ||
https://central.sonatype.com/api/v1/publisher/published?namespace=dev.eatsteak&name=rusaint&version=${{ steps.current_version.outputs.result }} \ | ||
| jq '.published | "result=" + .' \ | ||
| tr -d '"' >> $GITHUB_OUTPUT | ||
- name: Cancel workflow if version is already released | ||
if: steps.is_published.outputs.result == 'true' | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh run cancel ${{ github.run_id }} | ||
gh run watch ${{ github.run_id }} | ||
- name: Clear directory | ||
run: | | ||
rm -rf ./* | ||
rm -rf ./.git | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: 'armv7-linux-androideabi, i686-linux-android, aarch64-linux-android, x86_64-linux-android' | ||
- name: Retrieve cache | ||
uses: Leafwing-Studios/cargo-cache@v2 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 23 | ||
distribution: temurin | ||
cache: gradle | ||
- name: Setup Android SDK | ||
uses: android-actions/setup-android@v3 | ||
- name: Setup Android NDK | ||
uses: nttld/setup-ndk@v1 | ||
with: | ||
ndk-version: r27c | ||
link-to-sdk: true | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
- name: Build with Gradle | ||
run: | | ||
cd ./languages/kotlin | ||
chmod +x ./gradlew | ||
./gradlew build | ||
- name: Publish to local Maven repository | ||
run: | | ||
cd ./languages/kotlin | ||
./gradlew publish | ||
- name: Publish with JReleaser | ||
env: | ||
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} | ||
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVENCENTRAL_PASSWORD }} | ||
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | ||
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | ||
run: | | ||
cd ./languages/kotlin | ||
./gradlew jreleaserPublish | ||
- name: JReleaser release output | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: jreleaser-release | ||
path: | | ||
./languages/kotlin/lib/build/jreleaser/trace.log | ||
./languages/kotlin/lib/build/jreleaser/output.properties |
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
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
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
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