feat(ci): update build workflows
This commit is contained in:
parent
85dfb2962d
commit
b1c8a820b5
3 changed files with 41 additions and 60 deletions
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
|
|
@ -1,12 +1,8 @@
|
||||||
name: Build APK
|
name: Build Debug
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- '*'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- '*'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -18,15 +14,15 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: set up JDK 17
|
- name: set up JDK 21
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 21
|
||||||
distribution: 'zulu'
|
distribution: zulu
|
||||||
cache: 'gradle'
|
cache: "gradle"
|
||||||
|
|
||||||
- name: Build project with Gradle
|
- name: Build project with Gradle
|
||||||
run: chmod +x ./gradlew && ./gradlew :app:assembleDebug
|
run: chmod +x ./gradlew && ./gradlew :app:assembleDebug --stacktrace
|
||||||
|
|
||||||
- name: Upload apk as artifact
|
- name: Upload apk as artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|
|
||||||
77
.github/workflows/release.yml
vendored
77
.github/workflows/release.yml
vendored
|
|
@ -2,73 +2,58 @@ name: Publish Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
tags: [ "v*.*.*" ]
|
||||||
- 'release'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "release"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup JDK 21
|
||||||
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: true
|
java-version: 21
|
||||||
ref: release
|
|
||||||
path: src
|
|
||||||
|
|
||||||
- name: Check target version
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
cd $GITHUB_WORKSPACE/src
|
|
||||||
version=$(cat app/build.gradle.kts | grep -E 'versionName = "' | cut -d \" -f 2)
|
|
||||||
version="v$version"
|
|
||||||
if git show-ref --tags --quiet --verify -- "refs/tags/$version" >/dev/null; then
|
|
||||||
echo "Git tag $version already exists, failing to publish";
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "::set-output name=release_tag::$version"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Setup Android SDK
|
|
||||||
uses: android-actions/setup-android@v2
|
|
||||||
|
|
||||||
- name: Setup JDK 17
|
|
||||||
uses: actions/setup-java@v2
|
|
||||||
with:
|
|
||||||
java-version: 17
|
|
||||||
distribution: zulu
|
distribution: zulu
|
||||||
cache: gradle
|
cache: "gradle"
|
||||||
|
|
||||||
- name: Build Manager
|
- name: Build Manager
|
||||||
env:
|
env:
|
||||||
SIGNING_KEY_ALIAS: ${{ secrets.keyAlias }}
|
SIGNING_KEY_ALIAS: ${{ secrets.keyAlias }}
|
||||||
SIGNING_KEY_PASSWORD: ${{ secrets.keyPassword }}
|
SIGNING_KEY_PASSWORD: ${{ secrets.keyPassword }}
|
||||||
SIGNING_STORE_PASSWORD: ${{ secrets.keystorePassword }}
|
SIGNING_STORE_PASSWORD: ${{ secrets.keystorePassword }}
|
||||||
|
SIGNING_STORE_FILE: ${{ github.workspace }}/release.keystore
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE/src
|
echo "${{ secrets.keystore }}" | base64 -d > release.keystore
|
||||||
echo "${{ secrets.keystore }}" | base64 -d > ../../release.keystore
|
chmod +x ./gradlew && ./gradlew :app:packageRelease --stacktrace
|
||||||
|
rm release.keystore
|
||||||
|
|
||||||
chmod +x gradlew
|
- name: Upload apk as artifact
|
||||||
./gradlew :app:packageRelease
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: app
|
||||||
|
if-no-files-found: error
|
||||||
|
path: app/build/outputs/apk/release/app-release.apk
|
||||||
|
|
||||||
rm ../../release.keystore
|
- name: Publish Release
|
||||||
|
env:
|
||||||
- name: Release
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE/src
|
|
||||||
git config --local user.email "actions@github.com"
|
|
||||||
git config --local user.name "GitHub Actions"
|
|
||||||
|
|
||||||
tag="${{ steps.version.outputs.release_tag }}"
|
|
||||||
git tag "$tag"
|
|
||||||
git push origin "$tag"
|
|
||||||
|
|
||||||
apk_file="aliucord-manager-$tag.apk"
|
apk_file="aliucord-manager-$tag.apk"
|
||||||
mv -T ./app/build/outputs/apk/release/app-release.apk "../$apk_file"
|
mv -T ./app/build/outputs/apk/release/app-release.apk "./$apk_file"
|
||||||
|
|
||||||
gh release create "$tag" \
|
gh release create "$tag" \
|
||||||
--title "Aliucord Manager $tag" \
|
--title "Aliucord Manager $tag" \
|
||||||
|
--generate-notes \
|
||||||
|
--verify-tag \
|
||||||
|
--fail-on-no-commits \
|
||||||
"../$apk_name"
|
"../$apk_name"
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
|
||||||
6
.github/workflows/wrapper-validation.yml
vendored
6
.github/workflows/wrapper-validation.yml
vendored
|
|
@ -4,11 +4,11 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- gradle/**
|
- gradle/wrapper/**
|
||||||
- gradlew.*
|
- gradlew*
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- gradle/**
|
- gradle/wrapper/**
|
||||||
- gradlew*
|
- gradlew*
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue