Skip to content

build(Action): 添加 release-drafter #19

build(Action): 添加 release-drafter

build(Action): 添加 release-drafter #19

Workflow file for this run

# 发布发行版
name: publish release
on:
push:
tags:
- 'v*'
branches:
- 'main'
if: startsWith(github.ref, 'refs/tags')
workflow_dispatch:
env:
FLUTTER_VERSION: "3.27.2"
jobs:
# Android
build_apk:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# 创建 key.properties 和 keystore.jks
- name: Create key.properties and keystore.jks file
env:
KEY: ${{ secrets.ANDROID_KEY_PROPERTIES }}
STORE: ${{ secrets.ANDROID_KEY_STORE }}
run: |
echo $KEY | base64 -di > ./android/key.properties
echo $STORE | base64 -di > ./android/keystore.jks
- name: Set up JDK 20
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '20'
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Dependencies
run: flutter pub get
- name: Build Json
run: dart run build_runner build
- name: Build APK
run: |
flutter build apk --release
flutter build apk --release --split-per-abi
flutter build appbundle --release
mkdir App
cp ./build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ./App/Glidea-${{ github.ref_name }}-android-arm32v7.apk
cp ./build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ./App/Glidea-${{ github.ref_name }}-android-arm64v8.apk
cp ./build/app/outputs/flutter-apk/app-x86_64-release.apk ./App/Glidea-${{ github.ref_name }}-android-x64.apk
cp ./build/app/outputs/flutter-apk/app-release.apk ./App/Glidea-${{ github.ref_name }}-android.apk
cp ./build/app/outputs/bundle/release/app-release.aab ./App/Glidea-${{ github.ref_name }}-android.aab
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: apk-result
path: ./App/*
# Windows
build_windows:
runs-on: windows-latest
env:
INNO_PATH: "./windows/packaging/exe/inno-setup.iss"
APP_FOLDER: "P:[/\\\\]Root[/\\\\]Project[/\\\\]app[/\\\\]glidea[/\\\\]glidea"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update inno setup
run: |
echo "(Get-Content ${{ env.INNO_PATH }}) | ForEach-Object { $_ -replace '${{ env.APP_FOLDER }}', '${{ github.workspace }}' } | Set-Content ${{ env.INNO_PATH }}"
(Get-Content ${{ env.INNO_PATH }}) | ForEach-Object { $_ -replace '${{ env.APP_FOLDER }}', '${{ github.workspace }}' } | Set-Content ${{ env.INNO_PATH }}
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Dependencies
run: flutter pub get
- name: Build Json
run: dart run build_runner build
- name: Compile for Windows
run: flutter build windows
- name: Add DLL files
run: |
Copy-Item ./windows/packaging/lib/msvcp140.dll ./build/windows/x64/runner/Release/
Copy-Item ./windows/packaging/lib/vcruntime140.dll ./build/windows/x64/runner/Release/
Copy-Item ./windows/packaging/lib/vcruntime140_1.dll ./build/windows/x64/runner/Release/
- name: Zip compiled files
run: |
mkdir App, dist
Compress-Archive -Path ./build/windows/x64/runner/Release/* -DestinationPath ./App/Glidea-${{ github.ref_name }}-windows.zip
- name: Compile .ISS to .EXE Installer
uses: Minionguyjpro/Inno-Setup-Action@v1.2.2
with:
path: ${{ env.INNO_PATH }}
- name: Copy and rename exe file
run: |
ls ${{ github.workspace }}/dist
cp dist/Glidea.exe App/Glidea-${{ github.ref_name }}-windows.exe
- name: Enable flutter_distributor
run: |
dart pub global activate flutter_distributor
setx "Path" "%Path%;${{ env.PUB_CACHE }}\bin;" /m
- name: Build msix package
run: |
flutter_distributor package --platform windows --targets msix
cp dist/*/*glidea*.msix App/Glidea-${{ github.ref_name }}-windows.msix
- name: Upload Windows zip
uses: actions/upload-artifact@v4
with:
name: windows-result
path: ./App/*
# Linux_x64
build_linux-x86_64:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev libfuse2
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Dependencies
run: flutter pub get
- name: Build Json
run: dart run build_runner build
- name: Compile for Linux
run: flutter build linux
- name: Create tar.gz archive
run: |
mkdir App
cd ./build/linux/x64/release/bundle
tar -czvf ../../../../../App/Glidea-${{ github.ref_name }}-linux-x86-64.tar.gz *
cd ../../../../../
- name: Enable flutter_distributor
run: |
dart pub global activate flutter_distributor
echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> ~/.bashrc
- name: Build deb package
run: flutter_distributor package --platform linux --targets deb
- name: Copy file
run: cp dist/*/*glidea*.deb App/Glidea-${{ github.ref_name }}-linux-x86-64.deb
- name: Upload tar.gz archive
uses: actions/upload-artifact@v4
with:
name: linux-x86-64-result
path: ./App/*
# Linux_arm64
build_linux_arm_64:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev libfuse2
git config --global --add safe.directory /opt/hostedtoolcache/flutter/--
- uses: subosito/flutter-action@v2
with:
cache: true
channel: master
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Dependencies
run: flutter pub get
- name: Build Json
run: dart run build_runner build
- name: Compile for Linux
run: flutter build linux
- name: Create tar.gz archive
run: |
mkdir App
cd ./build/linux/arm64/release/bundle
tar -czvf ../../../../../App/Glidea-${{ github.ref_name }}-linux-arm-64.tar.gz *
cd ../../../../../
- name: Enable flutter_distributor
run: |
dart pub global activate flutter_distributor
echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> ~/.bashrc
- name: Build deb package
run: flutter_distributor package --platform linux --targets deb
- name: Copy file
run: cp dist/*/*glidea*.deb App/Glidea-${{ github.ref_name }}-linux-arm-64.deb
- name: Upload tar.gz archive
uses: actions/upload-artifact@v4
with:
name: linux-arm-64-result
path: ./App/*
# 发行
release:
needs:
- build_apk
- build_windows
- build_linux-x86_64
- build_linux_arm_64
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Draft release
id: draft_release
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download apk files
uses: actions/download-artifact@v4
with:
name: apk-result
path: ./release/
- name: Download windows files
uses: actions/download-artifact@v4
with:
name: windows-result
path: ./release/
- name: Download linux-x86-64 files
uses: actions/download-artifact@v4
with:
name: linux-x86-64-result
path: ./release/
- name: Download linux-arm-64 files
uses: actions/download-artifact@v4
with:
name: linux-arm-64-result
path: ./release/
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
files: ./release/*
body_path: ./CHANGELOG.md
name: ${{ steps.draft_release.outputs.name }}
tag_name: ${{ steps.draft_release.outputs.tag_name }}
append_body: ${{ steps.draft_release.outputs.body }}