修改版本号和 README #4
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 Android | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build_android: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/[email protected] | |
with: | |
flutter-version: '3.23.0-8.0.pre.3' | |
channel: 'master' | |
- name: Setup Java JDK | |
uses: actions/[email protected] | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
- run: flutter pub get | |
- run: flutter build apk --release | |
- name: Extract version from pubspec.yaml | |
id: extract_version | |
run: | | |
VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Upload APK as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android_${{ env.VERSION }}.apk | |
path: build/app/outputs/flutter-apk/app-release.apk | |
- name: Release | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: "build/app/outputs/flutter-apk/app-release.apk" | |
tag: ${{ env.VERSION }} | |
token: ${{ secrets.YOUR_GITHUB_TOKEN }} | |
build_linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/[email protected] | |
with: | |
flutter-version: '3.23.0-8.0.pre.3' | |
channel: 'master' | |
- name: Install Linux Dependencies | |
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev cmake ninja-build | |
- run: flutter pub get | |
- run: flutter build linux --release | |
- name: Extract version from pubspec.yaml | |
id: extract_version_linux | |
run: | | |
VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Compress Linux Build | |
run: | | |
tar -czvf linux_x64_${{ env.VERSION }}.tar.gz -C build/linux/x64/release/bundle . | |
- name: Upload bundle as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux_x64_${{ env.VERSION }}.tar.gz | |
path: linux_x64_${{ env.VERSION }}.tar.gz | |
- name: Release Linux | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: "linux_x64_${{ env.VERSION }}.tar.gz" | |
tag: ${{ env.VERSION }} | |
token: ${{ secrets.YOUR_GITHUB_TOKEN }} |