Skip to content

Commit

Permalink
[ci] Kotlin 릴리즈를 분리 (#181)
Browse files Browse the repository at this point in the history
# What's in this pull request
- resolved #126
  • Loading branch information
EATSTEAK authored Jan 29, 2025
1 parent 897ce9d commit ee65333
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 72 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/release-android.yml
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
9 changes: 3 additions & 6 deletions .github/workflows/release-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Release (iOS)

on:
workflow_run:
workflows: ["Release"]
types: [completed]
workflows: [ "Release" ]
types: [ completed ]
branches:
- main
workflow_dispatch:
Expand All @@ -18,7 +18,6 @@ jobs:
- name: Checkout Cargo.toml to check version
uses: actions/checkout@v4
with:
token: ${{ secrets.IOS_GITHUB_TOKEN }}
sparse-checkout: |
Cargo.toml
sparse-checkout-cone-mode: false
Expand All @@ -30,7 +29,7 @@ jobs:
run: |
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.IOS_GITHUB_TOKEN }}" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/EATSTEAK/rusaint-ios/releases \
| jq '.[0].tag_name | "result=" + .' \
Expand All @@ -48,8 +47,6 @@ jobs:
rm -rf ./.git
- name: Checkout the repository
uses: actions/checkout@v4
with:
token: ${{ secrets.IOS_GITHUB_TOKEN }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
Expand Down
68 changes: 13 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
- 'Cargo.toml'
workflow_dispatch:

permissions:
contents: write

env:
CARGO_TERM_COLOR: always
jobs:
Expand All @@ -16,7 +19,6 @@ jobs:
- name: Checkout Cargo.toml to check version
uses: actions/checkout@v4
with:
token: ${{ secrets.IOS_GITHUB_TOKEN }}
sparse-checkout: |
Cargo.toml
sparse-checkout-cone-mode: false
Expand All @@ -28,7 +30,7 @@ jobs:
run: |
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.IOS_GITHUB_TOKEN }}" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/EATSTEAK/rusaint/releases \
| jq '.[0].tag_name | "result=" + .' \
Expand All @@ -52,61 +54,17 @@ jobs:
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
run: cargo publish --package rusaint --verbose --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
- name: Publish to local Maven repository
- name: Create an GitHub Release
run: |
cd ./languages/kotlin
./gradlew publish
- name: Release 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 jreleaserRelease
- 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
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/EATSTEAK/rusaint/releases \
-d
'{"tag_name":"${{ steps.current_version.outputs.result }}","name":"${{ steps.current_version.outputs.result }}","generate_release_notes":true}'
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Hyomin Koo
Copyright (c) 2023-2025 Koo Hyomin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 2 additions & 10 deletions languages/kotlin/lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,13 @@ jreleaser {

project {
name = "rusaint"
copyright = "2024 EATSTEAK"
copyright = "2024-2025 EATSTEAK"
author("EATSTEAK")
}

release {
github {
repoOwner = "EATSTEAK"
name = "rusaint"
releaseName = "{{tagName}}"
releaseNotes {
enabled = true
}
changelog {
enabled = false
}
enabled = false
}
}

Expand Down

0 comments on commit ee65333

Please sign in to comment.