This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
fix: 版本为null #33
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: | |
go: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
GO_ARCH: [ "386", amd64, arm, arm64 ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download AList Source Code | |
run: | | |
cd $GITHUB_WORKSPACE/alist-lib/scripts | |
chmod +x *.sh | |
./init_alist_core.sh | |
./init_alist_web.sh | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.5 | |
cache-dependency-path: ${{ github.workspace }}/alist-lib/go.sum | |
- name: Build | |
run: | | |
cd $GITHUB_WORKSPACE/alist-lib | |
GOARCH=${{ matrix.GO_ARCH }} | |
declare -A goarch2cc=( ["arm64"]="aarch64-linux-android32-clang" ["arm"]="armv7a-linux-androideabi32-clang" ["amd64"]="x86_64-linux-android32-clang" ["386"]="i686-linux-android32-clang") | |
export CC="$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/${goarch2cc[$GOARCH]}" | |
declare -A arch2lib=( ["arm64"]="arm64-v8a" ["arm"]="armeabi-v7a" ["amd64"]="x86_64" ["386"]="x86") | |
export LIB="${arch2lib[$GOARCH]}" | |
./scripts/install_alist.sh $GOARCH $LIB | |
- name: Upload to Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "app_libs" | |
path: "${{ github.workspace }}/app/libs" | |
android: | |
runs-on: ubuntu-latest | |
needs: [ go ] | |
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 | |
- name: Setup Gradle | |
uses: gradle/[email protected] | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: "app_libs" | |
path: "${{ github.workspace }}/app/libs" | |
- 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 | |
id: gradle | |
run: ./gradlew assembleRelease -build-cache --parallel --daemon --warning-mode all | |
- name: Upload missing_rules.txt | |
if: failure() && steps.gradle.outcome != 'success' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "missing_rules" | |
path: "${{ github.workspace }}/app/build/outputs/mapping/release/missing_rules.txt" | |
- 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 arm64-v8a | |
if: success () || failure () | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "AListAndroid-v${{ env.ver_name }}_arm64-v8a" | |
path: "${{ env.output }}/*-v8a.apk" | |
- name: Upload App To Artifact arm-v7a | |
if: success () || failure () | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "AListAndroid-v${{ env.ver_name }}_arm-v7a" | |
path: "${{ env.output }}/*-v7a.apk" | |
- name: Upload App To Artifact x86 | |
if: success () || failure () | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "AListAndroid-v${{ env.ver_name }}_x86" | |
path: "${{ env.output }}/*_x86.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 }} |