CI-Build auto upload to Release in Pre-Release #352
Workflow file for this run
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: Android CI | |
on: | |
pull_request: | |
branches-ignore: | |
- '' | |
push: | |
tags: | |
- '*' | |
branches-ignore: | |
- '' | |
workflow_dispatch: | |
jobs: | |
InitCIBuild: | |
runs-on: ubuntu-20.04 | |
if: github.repository_owner == 'FCL-Team' && !startsWith(github.ref, 'refs/pull/') | |
name: Init & Prepare CI-Build | |
steps: | |
- name: Delete | |
uses: 8Mi-Tech/delete-release-assets-action@main | |
with: | |
github_token: "${{ secrets.TOKEN }}" | |
tag: CI-Build-${{github.ref_name}} | |
deleteOnlyFromDrafts: false | |
- name: Set Text | |
run: | | |
cat > ci-build.md << 'EOF' | |
Build Time / 构建时间 : ${{ steps.cslenv-github.outputs.buildtime }} | |
自动同步分支 ${{ github.ref_name }} 的代码,以保持最新 | |
Synchronize ${{ github.ref_name }} branch code updates, keeping only the latest version | |
<br> | |
EOF | |
- name: Update Tag | |
uses: richardsimko/[email protected] | |
with: | |
tag_name: CI-Build-${{github.ref_name}} | |
env: | |
GITHUB_TOKEN: "${{ secrets.TOKEN }}" | |
- uses: softprops/action-gh-release@v1 | |
with: | |
token: "${{ secrets.TOKEN }}" | |
name: FoldCraftLauncer CI-Build | |
tag_name: CI-Build-${{github.ref_name}} | |
prerelease: true | |
body_path: ci-build.md | |
FCLTeamBuild: | |
needs: InitCIBuild | |
if: github.repository_owner == 'FCL-Team' && !startsWith(github.ref, 'refs/pull/') | |
strategy: | |
matrix: | |
arch: [ "all", "arm", "arm64", "x86", "x64" ] | |
fail-fast: false | |
env: | |
FCL_KEYSTORE_PASSWORD: ${{ secrets.FCL_KEYSTORE_PASSWORD }} | |
CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }} | |
OAUTH_API_KEY: ${{ secrets.OAUTH_API_KEY }} | |
name: Build for ${{matrix.arch}} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Build ${{matrix.arch}} .apk | |
run: | | |
chmod +x gradlew | |
./gradlew assemblerelease -Darch=${{matrix.arch}} | |
- name: Release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: "${{ secrets.TOKEN }}" | |
files: | | |
FCL/build/outputs/apk/release/*.apk | |
- name: Upload apk | |
if: startsWith(github.ref, 'refs/heads/') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-${{matrix.arch}} | |
path: FCL/build/outputs/apk/release/* | |
# retention-days: 1 | |
- name: CI-Build Publish | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: "${{ secrets.TOKEN }}" | |
name: FoldCraftLauncer CI-Build | |
tag_name: CI-Build-${{github.ref_name}} | |
prerelease: true | |
files: FCL/build/outputs/apk/release/*.apk | |
#only for fork | |
DebugBuild: | |
if: github.repository_owner != 'FCL-Team' || startsWith(github.ref, 'refs/pull/') | |
name: Build Debug | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Build debug apk | |
run: | | |
chmod +x gradlew | |
./gradlew assemblefordebug -Darch=all | |
- name: Upload debug apk | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-debug-all | |
path: FCL/build/outputs/apk/fordebug/* |