feat: 与 Python 后端交互 #164
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: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build-and-release: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: Android, Linux, Web, Server | |
os: ubuntu-latest | |
- platform: Windows | |
os: windows-latest | |
name: Build and Release ${{ matrix.platform }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: '21' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- if: matrix.os == 'ubuntu-latest' | |
name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- if: matrix.os == 'ubuntu-latest' | |
name: Configure Android signing | |
shell: bash | |
run: | | |
if [ "${{ secrets.KEY }}" != "" ] && [ "${{ secrets.PROPERTIES }}" != "" ]; then | |
cd compose-app | |
echo ${{ secrets.KEY }} | base64 --decode > key.jks | |
echo ${{ secrets.PROPERTIES }} | base64 --decode > key.properties | |
fi | |
- name: Versioning | |
id: versioning | |
shell: bash | |
run: | | |
./gradlew ciVersioning | |
- if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
name: Create tag | |
shell: bash | |
continue-on-error: true | |
run: | | |
git tag ${{ steps.versioning.outputs.version }} | |
git push origin ${{ steps.versioning.outputs.version }} | |
- if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
name: Create release | |
shell: bash | |
continue-on-error: true | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases \ | |
-f tag_name=${{ steps.versioning.outputs.version }} \ | |
-F generate_release_notes=true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build ${{ matrix.platform }} app | |
shell: bash | |
run: | | |
./gradlew ciReleaseApp | |
- name: Upload ${{ matrix.platform }} app | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform }} app | |
path: build/assets/* | |
- if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
name: Release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
tag: refs/tags/${{ steps.versioning.outputs.version }} | |
file: build/assets/* | |
file_glob: true |