-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Credits to @janw4ld for the workflow file.
- Loading branch information
Showing
4 changed files
with
95 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,94 @@ | ||
name: build & release | ||
on: | ||
pull_request: | ||
branches: | ||
- Release | ||
push: | ||
branches: | ||
- Release | ||
branches: [Release, Dev] | ||
tags: | ||
- "*" | ||
env: | ||
app_ver: v1.1.9 | ||
name: "Build & Release" | ||
# A-SDK_PATH: /opt/android-sdk-linux | ||
flutter-version: "3.7.10" | ||
FLUTTER_CACHE: | | ||
.pub-cache | ||
/opt/hostedtoolcache/flutter/stable-3.7.10-x64/packages/flutter_tools | ||
BUILD_CACHE: | | ||
build | ||
.dart_tool | ||
jobs: | ||
build: | ||
name: Build & Release | ||
runs-on: macos-latest | ||
build-release: | ||
runs-on: ubuntu-22.04 | ||
# container: | ||
# image: cirrusci/flutter:3.7.10 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-java@v1 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '12.x' | ||
- uses: subosito/flutter-action@v1 | ||
distribution: "temurin" | ||
java-version: "11" | ||
cache: "gradle" | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '3.7.10' | ||
- run: flutter pub get | ||
flutter-version: ${{ env.flutter-version }} | ||
- name: pub+fluttertools cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.FLUTTER_CACHE }} | ||
key: pub-cache | ||
- name: build cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.BUILD_CACHE }} | ||
key: build-cache | ||
- run: | | ||
flutter build apk --release | ||
mv ./build/app/outputs/apk/release/app-release.apk ./Colorful_Notes_$app_ver.apk | ||
flutter build apk --release --split-per-abi | ||
mv ./build/app/outputs/apk/release/app-arm64-v8a-release.apk ./build/app/outputs/apk/release/Colorful_Notes_$app_ver-arm64-v8a.apk | ||
mv ./build/app/outputs/apk/release/app-armeabi-v7a-release.apk ./build/app/outputs/apk/release/Colorful_Notes_$app_ver-armeabi-v7a.apk | ||
mv ./build/app/outputs/apk/release/app-x86_64-release.apk ./build/app/outputs/apk/release/Colorful_Notes_$app_ver-x86_64.apk | ||
mv ./Colorful_Notes_$app_ver.apk ./build/app/outputs/apk/release/Colorful_Notes_$app_ver.apk | ||
- name: Push to Releases | ||
# build release apks | ||
## environment setup | ||
app_ver=$(grep 'version:' pubspec.yaml) | ||
app_ver=$(echo "${app_ver/'version:'/}" | xargs) | ||
echo "$app_ver" | ||
echo "app_ver=$app_ver" >>$GITHUB_ENV | ||
export PUB_CACHE=$GITHUB_WORKSPACE/.pub-cache | ||
export PATH="$PATH":"$PUB_CACHE/bin" | ||
mkdir artifacts && { | ||
ARTIFACTS_PATH="$GITHUB_WORKSPACE/artifacts" | ||
echo "ARTIFACTS_PATH=$ARTIFACTS_PATH" >>$GITHUB_ENV | ||
} | ||
echo "$JAVA_KEYSTORE" | base64 -d >keystore.jks | ||
## build | ||
flutter pub get | ||
flutter build apk --release --split-per-abi | ||
(cd ./build/app/outputs/flutter-apk/ && { | ||
mv ./app-arm64-v8a-release.apk "$ARTIFACTS_PATH/Colorful_Notes-$app_ver-arm64-v8a.apk" | ||
mv ./app-armeabi-v7a-release.apk "$ARTIFACTS_PATH/Colorful_Notes-$app_ver-armeabi-v7a.apk" | ||
mv ./app-x86_64-release.apk "$ARTIFACTS_PATH/Colorful_Notes-$app_ver-x86_64.apk" | ||
}) | ||
flutter build apk --release | ||
(cd ./build/app/outputs/flutter-apk/ && | ||
mv ./app-release.apk "$ARTIFACTS_PATH/Colorful_Notes-$app_ver-universal.apk" | ||
) | ||
rm -rf ./build/app/outputs/apk # remove dupe apk dir | ||
shell: bash | ||
env: | ||
JAVA_KEYSTORE: ${{ secrets.JAVA_KEYSTORE }} | ||
JAVA_KEYPASS: ${{ secrets.JAVA_KEYPASS }} | ||
- name: Upload build artifacts to release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "build/app/outputs/apk/release/*" | ||
tag: ${{ env.app_ver }} | ||
token: ${{ secrets.TOKEN }} | ||
artifacts: ${{ env.ARTIFACTS_PATH }}/*.apk | ||
token: ${{ secrets.TOKEN }} | ||
|
||
- name: Upload build artifacts to workflow | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: v${{ env.app_ver }} | ||
path: ${{ env.ARTIFACTS_PATH }}/*.apk |
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
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
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