更新自动构建文件 #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: 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: 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' | |
- 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.tar.gz -C build/linux/x64/release/bundle . | |
- name: Release Linux | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: "linux_x64.tar.gz" | |
tag: ${{ env.VERSION }} | |
token: ${{ secrets.YOUR_GITHUB_TOKEN }} |