This repository has been archived by the owner on May 15, 2024. It is now read-only.
add github action; #1
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: Flutter app build and release | |
env: | |
TAG_NAME: "v1" | |
RELEASE_TITLE: "Transfer-client v1" | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
linux: | |
name: Build linux app | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup dart and flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.13.8" | |
- name: flutter get dependency | |
run: | | |
flutter pub get | |
- name: Build and compress | |
run: | | |
flutter build linux --obfuscate --split-debug-info=/tcli.debug-info | |
tar zcvf tcli_linux64.tar.gz ./build/linux/x64/release/bundle | |
- name: "Uplaod artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tcli-linux | |
path: | | |
./tcli_linux64.tar.gz | |
retention-days: 1 | |
android: | |
name: Build android apk | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup dart and flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.13.8" | |
- name: flutter get dependency | |
run: | | |
flutter pub get | |
- name: Build apk | |
run: | | |
flutter build apk --no-shrink --split-per-abi --obfuscate --split-debug-info=/tcli.debug-info | |
- name: "Uplaod artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tcli-android | |
path: | | |
./build/app/outputs/apk/release/* | |
retention-days: 1 | |
publish: | |
needs: [linux, android] | |
runs-on: ubuntu-latest | |
env: | |
GH_REPO: ${{ github.repository }} | |
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y gettext-base | |
- name: Delete existing release | |
run: | | |
gh release delete $TAG_NAME --yes || true | |
- name: Create Release and Upload Release Asset | |
run: | | |
gh release create $TAG_NAME --notes-file "./.github/workflows/release_note.md" --title "$RELEASE_TITLE" --target $GITHUB_SHA tcli-linux/* tcli-android/* |