add all platform icon and change apk package name #11
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 Flutter App | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [windows, linux, android] | |
include: | |
- platform: windows | |
os: windows-latest | |
build-command: flutter build windows --release | |
artifact-path: build/windows/x64/runner/Release | |
artifact-name: clsswjz-${{ github.ref_name }}-windows-x64 | |
ext: .zip | |
- platform: linux | |
os: ubuntu-latest | |
build-command: flutter build linux --release | |
artifact-path: build/linux/x64/release/bundle | |
artifact-name: clsswjz-${{ github.ref_name }}-linux-x64 | |
ext: .zip | |
- platform: android | |
os: ubuntu-latest | |
build-command: flutter build apk --release --no-tree-shake-icons | |
artifact-path: build/app/outputs/flutter-apk/app-release.apk | |
artifact-name: clsswjz-${{ github.ref_name }}-android-arm64 | |
ext: .apk | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Java | |
if: matrix.platform == 'android' | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24.5' | |
channel: 'stable' | |
- name: Install Linux dependencies | |
if: matrix.platform == 'linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build libgtk-3-dev | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Build ${{ matrix.platform }} | |
run: ${{ matrix.build-command }} | |
- name: Create ZIP (Windows) | |
if: matrix.platform == 'windows' | |
run: | | |
cd build/windows/x64/runner/Release | |
7z a ../../../../../${{ matrix.artifact-name }}${{ matrix.ext }} * | |
- name: Create ZIP (Linux) | |
if: matrix.platform == 'linux' | |
run: | | |
cd build/linux/x64/release/bundle | |
zip -r ../../../../../${{ matrix.artifact-name }}${{ matrix.ext }} * | |
- name: Rename Android APK | |
if: matrix.platform == 'android' | |
run: | | |
mv build/app/outputs/flutter-apk/app-release.apk ${{ matrix.artifact-name }}${{ matrix.ext }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.artifact-name }} | |
path: ${{ matrix.artifact-name }}${{ matrix.ext }} | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: List artifacts | |
run: ls -R artifacts/ | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
artifacts/clsswjz-${{ github.ref_name }}-android-arm64/clsswjz-${{ github.ref_name }}-android-arm64.apk | |
artifacts/clsswjz-${{ github.ref_name }}-windows-x64/clsswjz-${{ github.ref_name }}-windows-x64.zip | |
artifacts/clsswjz-${{ github.ref_name }}-linux-x64/clsswjz-${{ github.ref_name }}-linux-x64.zip | |
draft: false | |
prerelease: false | |
name: Release ${{ github.ref_name }} | |
body: | | |
Release ${{ github.ref_name }} | |
Automated release for: | |
- Windows (x64): clsswjz-${{ github.ref_name }}-windows-x64.zip | |
- Linux (x64): clsswjz-${{ github.ref_name }}-linux-x64.zip | |
- Android (arm64): clsswjz-${{ github.ref_name }}-android-arm64.apk | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |