Deploy #33
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: Deploy | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: [ Analyze and Test ] | |
types: | |
- completed | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
pages: write | |
id-token: write | |
jobs: | |
android: | |
name: Build and Deploy Android | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: beta | |
cache: true | |
- name: Cache build_runner | |
uses: actions/cache@v2 | |
with: | |
path: '**/.dart_tool/build' | |
key: build-runner-${{ hashFiles('**/asset_graph.json') }}-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: build-runner- | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Exec build_runner | |
run: dart pub run build_runner build | |
- name: Build APK | |
run: flutter build apk --release | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android | |
path: build/app/outputs/apk/release/app-release.apk | |
ios: | |
name: Build and Deploy iOS | |
runs-on: macos-latest | |
if: ${{ (github.ref == 'refs/heads/main') && (github.event.workflow_run.conclusion == 'success') }} | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: beta | |
cache: true | |
- name: Cache build_runner | |
uses: actions/cache@v2 | |
with: | |
path: '**/.dart_tool/build' | |
key: build-runner-${{ hashFiles('**/asset_graph.json') }}-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: build-runner- | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Exec build_runner | |
run: dart pub run build_runner build | |
- name: Build iOS | |
run: flutter build ios --release --no-codesign | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ios | |
path: app-release.ipa | |
web: | |
name: Build and Deploy Web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: beta | |
cache: true | |
- name: Cache build_runner | |
uses: actions/cache@v2 | |
with: | |
path: '**/.dart_tool/build' | |
key: build-runner-${{ hashFiles('**/asset_graph.json') }}-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: build-runner- | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Exec build_runner | |
run: dart pub run build_runner build | |
- name: Build Web | |
run: flutter build web --base-href /${{ github.event.repository.name }}/ | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: './build/web' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |