This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
Release #13
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: Release | |
on: | |
push: | |
branches: | |
- "master" | |
paths: | |
- "CHANGELOG.md" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
output: "${{ github.workspace }}/app/build/outputs/apk/release" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.3 | |
cache: false | |
cache-dependency-path: ${{ github.workspace }}/alist-lib/go.sum | |
- uses: actions/cache@v3 | |
name: Cache Go Modules | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
go- | |
- name: Build Alist-lib | |
run: | | |
cd alist-lib/scripts | |
chmod +x *.sh | |
./install_alist.sh | |
./install_web.sh | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
gomobile init | |
go get golang.org/x/mobile/bind | |
./install_aar.sh all | |
- name: Setup Gradle | |
uses: gradle/[email protected] | |
- name: Init Signature | |
run: | | |
touch local.properties | |
echo ALIAS_NAME='${{ secrets.ALIAS_NAME }}' >> local.properties | |
echo ALIAS_PASSWORD='${{ secrets.ALIAS_PASSWORD }}' >> local.properties | |
echo KEY_PASSWORD='${{ secrets.KEY_PASSWORD }}' >> local.properties | |
echo KEY_PATH='./key.jks' >> local.properties | |
# 从Secrets读取无换行符Base64解码, 然后保存到到app/key.jks | |
echo ${{ secrets.KEY_STORE }} | base64 --decode > $GITHUB_WORKSPACE/app/key.jks | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew assembleRelease -build-cache --parallel --daemon --warning-mode all | |
- name: Init APP Version Name | |
run: | | |
echo "ver_name=$(grep -m 1 'versionName' ${{ env.output }}/output-metadata.json | cut -d\" -f4)" >> $GITHUB_ENV | |
- name: Upload App To Artifact | |
if: success () || failure () | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "AlistAndroid_${{env.ver_name}}" | |
path: ${{ env.output }}/*.apk | |
- uses: softprops/[email protected] | |
with: | |
name: ${{ env.ver_name }} | |
tag_name: ${{ env.ver_name }} | |
body_path: ${{ github.workspace }}/CHANGELOG.md | |
draft: false | |
prerelease: false | |
files: ${{ env.output }}/*.apk | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} |