-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from SummonHIM/main
optimize workflow
- Loading branch information
Showing
4 changed files
with
105 additions
and
30 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,32 @@ | ||
name: Develop CI | ||
|
||
on: | ||
push: | ||
branches-ignore: [ main ] | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build debug apk with Gradle | ||
uses: gradle/gradle-command-action@v2 | ||
with: | ||
arguments: assembleDebug | ||
|
||
- name: Upload debug apk to artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: app-debug | ||
path: ${{github.workspace}}/app/build/outputs/apk/debug/*.apk |
This file was deleted.
Oops, something went wrong.
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,63 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: '*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Prepare signing key | ||
run: echo '${{ secrets.SIGNING_KEY }}' | base64 -d > signingkey.jks | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build release binary with Gradle | ||
uses: gradle/gradle-command-action@v2 | ||
env: | ||
ALIAS: ${{ secrets.ALIAS }} | ||
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | ||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | ||
with: | ||
arguments: assembleRelease | ||
|
||
- name: Clean up | ||
run: | | ||
rm signingkey.jks | ||
rm -f ${{github.workspace}}/app/build/outputs/apk/release/app-release-unsigned.apk | ||
- name: Upload release binary to artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: app-release | ||
path: ${{github.workspace}}/app/build/outputs/apk/release/*.apk | ||
|
||
- name: Setup release info | ||
run: | | ||
cd ${{github.workspace}}/app/build/outputs/apk/release | ||
echo "OPT_APK_SHA=$(sha256sum *.apk | awk '{ print $1 }')" >> $GITHUB_ENV | ||
echo "OPT_APK_NAME=$(ls *.apk)" >> $GITHUB_ENV | ||
- name: Create & upload new release draft | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Doraemon | ||
tag_name: ${{ github.ref_name }} | ||
draft: true | ||
files: ${{github.workspace}}/app/build/outputs/apk/release/*.apk | ||
body: | | ||
### 文件校验 | ||
| 文件 | SHA-256 | | ||
| --- | --- | | ||
| ${{ env.OPT_APK_NAME }} | ${{ env.OPT_APK_SHA }} | |
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