Downgrade to cubit #120
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 & release | |
on: | |
push: | |
env: | |
flutter-version: "3.10.5" | |
FLUTTER_TOOLS_CACHE: | | |
/opt/hostedtoolcache/flutter/stable-3.10.5-x64/packages/flutter_tools | |
BUILD_CACHE: | | |
build | |
.dart_tool | |
jobs: | |
build-release: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "11" | |
cache: "gradle" | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.flutter-version }} | |
- name: fluttertools cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.FLUTTER_TOOLS_CACHE }} | |
key: fluttertools-cache-v${{ env.flutter-version }} | |
restore-keys: | | |
fluttertools-cache-v${{ env.flutter-version }} | |
fluttertools-cache- | |
- name: pub cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.PUB_CACHE }} | |
key: pub-cache-${{ hashFiles('pubspec.lock') }} | |
restore-keys: | | |
pub-cache-${{ hashFiles('pubspec.lock') }} | |
pub-cache- | |
- name: build cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.BUILD_CACHE }} | |
key: build-cache-${{ hashFiles('**/*') }} | |
restore-keys: build-cache- | |
- run: | | |
# build release apks | |
## environment setup | |
app_ver=$(grep 'version:' pubspec.yaml) | |
app_ver=$(echo "${app_ver/'version:'/}" | xargs) | |
echo "v$app_ver" | |
echo "app_ver=$app_ver" >>$GITHUB_ENV | |
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/$APP_NAME-$app_ver-arm64-v8a.apk" | |
mv ./app-armeabi-v7a-release.apk "$ARTIFACTS_PATH/$APP_NAME-$app_ver-armeabi-v7a.apk" | |
mv ./app-x86_64-release.apk "$ARTIFACTS_PATH/$APP_NAME-$app_ver-x86_64.apk" | |
}) | |
flutter build apk --release | |
(cd ./build/app/outputs/flutter-apk/ && | |
mv ./app-release.apk "$ARTIFACTS_PATH/$APP_NAME-$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 }} | |
APP_NAME: ${{ github.event.repository.name }} | |
- name: Upload build artifacts to release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: ${{ env.ARTIFACTS_PATH }}/*.apk | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload build artifacts to workflow | |
uses: actions/upload-artifact@v3 | |
with: | |
name: v${{ env.app_ver }} | |
path: ${{ env.ARTIFACTS_PATH }}/*.apk |