デプロイ(Android aab) #26
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: デプロイ(Android aab) | |
on: [workflow_dispatch] | |
permissions: | |
contents: write | |
env: | |
GIT_USER_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com' | |
GIT_USER_NAME: 'github-actions[bot]' | |
jobs: | |
build_for_aab: | |
name: Android aab | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Flutter version from .fvmrc | |
run: echo "FLUTTER_FVM_VERSION=$(jq -r .flutter .fvmrc)" >> $GITHUB_ENV | |
- name: Install flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_FVM_VERSION }} | |
cache: true | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Cache pubspec dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.FLUTTER_HOME }}/.pub-cache | |
**/.packages | |
**/.flutter-plugins | |
**/.flutter-plugin-dependencies | |
**/.dart_tool/package_config.json | |
key: build-pubspec-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: | | |
build-pubspec- | |
- name: Flutter pub get | |
run: flutter pub get | |
- name: Initialize git config | |
run: | | |
git config --local user.name $GIT_USER_NAME | |
git config --local user.email $GIT_USER_EMAIL | |
- name: Run flutter test with coverage | |
run: flutter test --coverage --coverage-path=~/coverage/lcov.info | |
- name: Create aab file | |
run: | | |
echo -n "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > ./android/release.keystore | |
export ANDROID_KEYSTORE_PASSWORD="${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" | |
export ANDROID_KEY_ALIAS="${{ secrets.ANDROID_KEY_ALIAS }}" | |
export ANDROID_KEY_PASSWORD="${{ secrets.ANDROID_KEY_PASSWORD }}" | |
flutter build appbundle --no-tree-shake-icons --release | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-release.aab | |
# 保存するファイル | |
path: ./build/app/outputs/bundle/release/app-release.aab | |
# 保存期間(日) | |
retention-days: 3 |