Build & Release #18
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: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
android-build: | |
name: Build signed Android binaries | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
- run: flutter clean | |
- name: Cache pub dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.FLUTTER_HOME }}/.pub-cache | |
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: ${{ runner.os }}-pub- | |
- run: flutter pub get | |
- run: flutter pub run build_runner build --delete-conflicting-outputs | |
- run: flutter build apk --release | |
- name: Upload app bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: apk | |
path: build/app/outputs/flutter-apk/app-release.apk | |
retention-days: 1 | |
web-build: | |
name: Build web app and deploy to github pages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
- run: flutter clean | |
- name: Cache pub dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.FLUTTER_HOME }}/.pub-cache | |
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: ${{ runner.os }}-pub- | |
- run: flutter pub get | |
- run: flutter pub upgrade | |
- run: flutter pub run build_runner build --delete-conflicting-outputs | |
- run: flutter build web --base-href=/MonkeyMon/ | |
- uses: vimtor/[email protected] | |
with: | |
files: build/web/ | |
dest: monkey_mon_web.zip | |
- name: Upload web bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: web | |
path: monkey_mon_web.zip | |
retention-days: 1 | |
- name: Deploy to GitHub Pages 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build/web | |
ios-build: | |
name: Build unsigned ios binaries | |
runs-on: macos-13 | |
steps: | |
# Checks-out our repository under $GITHUB_WORKSPACE, so our job can access it | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Select Xcode version | |
run: sudo xcode-select -s '/Applications/Xcode_15.0.1.app/Contents/Developer' | |
# Install flutter | |
- name: Flutter get | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
# Install your project's dependencies | |
- run: flutter clean | |
- name: Cache pub dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.FLUTTER_HOME }}/.pub-cache | |
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: ${{ runner.os }}-pub- | |
- run: flutter pub get | |
# Build and sign the ipa using a single flutter command | |
- run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Building IPA | |
run: flutter build ipa --release --no-codesign | |
# Collect the file and upload as artifact | |
- name: collect ipa artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ipa | |
# Path to the release files | |
path: build/ios/archive/Runner.xcarchive | |
release: | |
name: Create Github release | |
needs: [android-build, ios-build, web-build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: apk | |
path: build | |
- uses: actions/download-artifact@v3 | |
with: | |
name: ipa | |
path: build | |
- uses: actions/download-artifact@v3 | |
with: | |
name: web | |
path: build | |
- uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: false | |
title: "Development Build" | |
files: | | |
build/app-release.apk | |
build/monkey_mon_web.zip | |
build/Runner.xcarchive |