Skip to content

デプロイ

デプロイ #114

Workflow file for this run

name: デプロイ
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_iOS:
name: iOS・Android用ビルド
runs-on: macos-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: Create symbolic link
run: ln -s ${{ env.FLUTTER_ROOT }} $HOME/work/flutter
- 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: Bump up version
run: |
flutter pub run cider bump build --bump-build
echo "BUMP_VERSION=$(flutter pub run cider version)" >> $GITHUB_ENV
- name: Commit and push pubspec.yaml
run: |
git add -u pubspec.yaml
echo "Bumped version number to $BUMP_VERSION" | git commit --file=-
git push
- name: Run flutter test with coverage
run: flutter test --coverage --coverage-path=~/coverage/lcov.info
- name: Extract App Store Connect API Private Key in ./private_keys
env:
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_AUTHKEY_P8_BASE64: ${{ secrets.APPLE_API_AUTHKEY_P8_BASE64 }}
run: |
mkdir ./private_keys
echo -n "$APPLE_API_AUTHKEY_P8_BASE64" | base64 --decode --output ./private_keys/AuthKey_$APPLE_API_KEY_ID.p8
- name: Create archive file
run: flutter build ipa --no-tree-shake-icons --release --no-codesign
- name: Release by fastlane
env:
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MATCH_REPOSITORY_ACCESS_TOKEN: ${{ secrets.MATCH_REPOSITORY_ACCESS_TOKEN }}
MATCH_REPOSITORY_USERNAME: ${{ secrets.MATCH_REPOSITORY_USERNAME }}
run: |
cd ios
bundle install
fastlane release
- name: Create apk file
run: |
echo -n "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode --output ./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 apk --no-tree-shake-icons --release
mv ./build/app/outputs/flutter-apk/app-release.apk ./build/app/outputs/flutter-apk/miria-$BUMP_VERSION.apk
- name: Create tag and release note
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v$BUMP_VERSION --generate-notes --draft ./build/app/outputs/flutter-apk/miria-$BUMP_VERSION.apk