This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
1 #40
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: Build | |
on: | |
push: | |
branches: | |
- "master" | |
paths-ignore: | |
- "*.md" | |
- "*.sh" | |
- "release.yaml" | |
- "sync_alist.yaml" | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: "Enable debug mode" | |
required: false | |
default: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
product: [ { name: "AListLatestRelease-最新Release版", value: latestRelease }, { name: "AListLatestCommit-最新提交版", value: latestCommit } ] | |
fail-fast: false | |
env: | |
product: ${{ matrix.product.value }} | |
output: "${{ github.workspace }}/app/build/outputs/apk/release" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: false | |
with: | |
detached: true | |
- 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: ${{ env.product }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ env.product }}-go- | |
- name: Build Alist-lib | |
run: | | |
cd alist-lib/scripts | |
chmod +x *.sh | |
if [ $product == "latestRelease" ]; then | |
./install_alist.sh | |
else | |
./install_alist_commits.sh | |
fi | |
./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/gradle-build-action@v2.4.2 | |
- 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 To Lanzou | |
# continue-on-error: true | |
# run: | | |
# path="${{ env.output }}" | |
# LANZOU_FOLDER_ID="8141093" | |
# export ylogin="" | |
# export phpdisk_info="" | |
# | |
# python3 $GITHUB_WORKSPACE/.github/scripts/lzy_web.py "$path" "$LANZOU_FOLDER_ID" | |
# echo "[$(date -u -d '+8 hour' '+%Y.%m.%d %H:%M:%S')] 分享链接: " | |
- name: Upload App To Artifact | |
if: success () || failure () | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "Alist-${{ env.product }}-v${{ env.ver_name }}" | |
path: "${{ env.output }}/AList-v${{env.ver_name}}.apk" |