Application Release #121
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: Application Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to bump' | |
required: true | |
type: choice | |
default: 'none' | |
options: | |
- none | |
- major | |
- minor | |
- patch | |
- pre | |
- release | |
release_title: | |
description: 'Release title' | |
type: string | |
required: false | |
env: | |
VERSION_BUMP: ${{ github.event.inputs.version }} | |
RELEASE_TITLE: ${{ github.event.inputs.release_title }} | |
jobs: | |
android-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: setup actions | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: parse flutter version | |
run: | | |
export FLUTTER_VERSION=$(./.github/workflows/get_flutter_version.sh) | |
echo "FLUTTER_VERSION=$FLUTTER_VERSION" >> $GITHUB_ENV | |
- name: setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: cache flutter dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.PUB_CACHE }} | |
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: ${{ runner.os }}-flutter- | |
- name: get flutter dependencies | |
run: flutter pub get | |
- name: bump version | |
if: ${{ github.event.inputs.version != 'none' }} | |
run: | | |
dart pub global activate cider | |
cider bump ${{ env.VERSION_BUMP }} --bump-build | |
- name: configure release keys | |
env: | |
KEYSTORE: ${{ secrets.KEYSTORE }} | |
KEYCONFIG: ${{ secrets.KEYCONFIG }} | |
run: | | |
mkdir -p android/keys | |
echo "$KEYSTORE" | base64 -d > android/keys/key.pkcs | |
echo "$KEYCONFIG" | base64 -d > android/keys/key.properties | |
- name: build APK | |
run: flutter build apk | |
- name: build AAB | |
run: flutter build appbundle | |
- name: package release | |
run: | | |
mv build/app/outputs/flutter-apk/app-release.apk app-release.apk | |
mv build/app/outputs/bundle/release/app-release.aab app-release.aab | |
- name: upload APK to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-apk | |
path: app-release.apk | |
- name: upload AAB to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-aab | |
path: app-release.aab | |
ios-build: | |
runs-on: macos-latest | |
steps: | |
- name: setup actions | |
uses: actions/checkout@v4 | |
- name: parse flutter version | |
run: | | |
export FLUTTER_VERSION=$(./.github/workflows/get_flutter_version.sh) | |
echo "FLUTTER_VERSION=$FLUTTER_VERSION" >> $GITHUB_ENV | |
- name: setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: cache flutter dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.PUB_CACHE }} | |
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: ${{ runner.os }}-flutter- | |
- name: get flutter dependencies | |
run: flutter pub get | |
- name: bump version | |
if: ${{ github.event.inputs.version != 'none' }} | |
run: | | |
dart pub global activate cider | |
cider bump ${{ env.VERSION_BUMP }} --bump-build | |
- name: build IPA | |
run: flutter build ios --no-codesign | |
- name: package release | |
run: | | |
cd build/ios/iphoneos | |
mkdir Payload | |
mv Runner.app Payload/Runner.app | |
zip -9 -r Runner.zip Payload | |
mv Runner.zip ../../../Runner.ipa | |
- name: upload IPA to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-ios | |
path: Runner.ipa | |
release: | |
needs: [android-build, ios-build] | |
if: ${{ github.ref == 'refs/heads/master' && github.event.inputs.version != 'none' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: setup actions | |
uses: actions/checkout@v4 | |
- name: setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0' | |
bundler-cache: true | |
- name: parse flutter version | |
run: | | |
export FLUTTER_VERSION=$(./.github/workflows/get_flutter_version.sh) | |
echo "FLUTTER_VERSION=$FLUTTER_VERSION" >> $GITHUB_ENV | |
- name: setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: setup cider | |
run: dart pub global activate cider | |
- name: bump and release version | |
run: | | |
cider bump ${{ env.VERSION_BUMP }} --bump-build | |
cider release | |
- name: get new version | |
run: echo "VERSION=$(cider version)" >> $GITHUB_ENV | |
- name: get new build number | |
run: | | |
VERSION=${{ env.VERSION }} | |
BUILD_NUMBER=${VERSION#*+} | |
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV | |
- name: write playstore changelogs | |
run: bundle exec fastlane android changelog | |
- name: commit version increase | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: increased version | |
default_author: github_actions | |
add: | | |
pubspec.yaml | |
CHANGELOG.md | |
fastlane | |
- name: download APK from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-apk | |
- name: download AAB from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-aab | |
- name: download IPA from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-ios | |
- name: arrange asset files | |
run: | | |
mkdir -p build/app/outputs/bundle/release | |
mv app-release.aab build/app/outputs/bundle/release/ | |
mv app-release.apk e1547.apk | |
mv Runner.ipa e1547.ipa | |
- name: configure playstore keys | |
env: | |
KEYSTORE: ${{ secrets.PLAYSTORE }} | |
run: | | |
mkdir -p android/keys | |
echo "$KEYSTORE" > android/keys/playstore.json | |
- name: publish to Play Store | |
run: bundle exec fastlane android upload | |
- name: create release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
name: ${{ env.RELEASE_TITLE }} | |
body_path: ./fastlane/metadata/android/en-US/changelogs/${{ env.BUILD_NUMBER }}.txt | |
files: | | |
e1547.apk | |
e1547.ipa |