Skip to content

Nightly Build

Nightly Build #548

Workflow file for this run

name: Nightly Build
on:
schedule:
# 北京时间 04:00(UTC 20:00)
- cron: "0 20 * * *"
workflow_dispatch: # 手动按钮
push:
branches: [ master ]
jobs:
build:
name: Nightly Build
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Generate version
id: ver
shell: bash
run: |
echo "DATE=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
echo "DATETIME=$(date '+%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
- uses: actions/checkout@v7
- name: Set up JDK
uses: actions/setup-java@v5.7.0
with:
java-version: 21
distribution: 'zulu'
- name: Cache Maven packages
uses: actions/cache@v6
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: |
mvn clean package
- name: Package in Windows
run: |
./PackageWindows.ps1
if: runner.os == 'Windows'
- name: Package in Linux
run: |
chmod u+x ./PackageLinux.sh
./PackageLinux.sh
if: runner.os == 'Linux'
- name: Package in macOS
run: |
chmod u+x ./PackageMacos.sh
./PackageMacos.sh
if: runner.os == 'macOS'
- name: Rename Artifacts
shell: bash
run: |
for file in target/ApkToolBoxGUI-*-with*-JRE-*.zip; do mv "$file" "target/ApkToolBoxGUI-${{ steps.ver.outputs.DATE }}-${file#target/ApkToolBoxGUI-*-}"; done
- uses: actions/upload-artifact@v7
with:
name: ApkToolBoxGUI-${{ runner.os }}
path: target/ApkToolBoxGUI-*-with*-JRE-*.zip
release:
name: Publish Nightly Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Generate version
id: ver
shell: bash
run: |
echo "DATE=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Publish Nightly Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
# 删除旧 release 和 tag
gh release delete nightly-build --repo ${{ github.repository }} --yes --cleanup-tag 2>/dev/null || true
# 确保 git tag 也被删除
gh api -X DELETE repos/${{ github.repository }}/git/refs/tags/nightly-build 2>/dev/null || true
# 创建新 release 并上传所有产物
gh release create nightly-build \
--repo ${{ github.repository }} \
--title "Nightly Build ${{ steps.ver.outputs.DATE }}" \
--notes "Auto nightly build version, based on commit ${{ github.sha }}. This is only for developer or alpha/beta test users。" \
--prerelease \
artifacts/**/*.zip