Production Release #15
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: Production Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version_bump_type: | |
type: choice | |
required: true | |
options: | |
- major | |
- minor | |
- patch | |
- build | |
default: "patch" | |
description: Version bump type | |
skip_analysis_checks: | |
type: boolean | |
required: false | |
default: false | |
description: Skip running analysis checks | |
skip_tests: | |
type: boolean | |
required: false | |
default: false | |
description: Skip running tests | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
sanity_check: | |
name: Format, Analyse & Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Initialize environment variables from FVM config | |
uses: kuhnroyal/flutter-fvm-config-action@v2 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: Install tools | |
run: ./tool/install.sh | |
- run: flutter doctor | |
- run: flutter pub get | |
- if: ${{ !inputs.skip_analysis_checks }} | |
run: flutter format --set-exit-if-changed -l 120 lib | |
- run: flutter packages pub run build_runner build | |
- if: ${{ !inputs.skip_analysis_checks }} | |
run: flutter analyze lib | |
- if: ${{ !inputs.skip_tests }} | |
run: flutter test --no-pub | |
release: | |
needs: [ sanity_check ] | |
name: Create release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
- name: Initialize environment variables from FVM config | |
uses: kuhnroyal/flutter-fvm-config-action@v2 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: Install tools | |
run: ./tool/install.sh | |
- run: flutter doctor | |
- run: flutter pub get | |
# Bump version | |
- name: Bump package version | |
run: | | |
TAG="v$(dart run ./bin/bump_package_version.dart --versionBumpType '${{ inputs.version_bump_type }}' | tail -n1)" | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
# Commit version changes | |
- name: Commit Release Changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: '[BUILD] ${{ env.TAG }} [skip ci]' | |
file_pattern: pubspec.yaml | |
# Create release entry & Trigger deployment | |
- name: Create Release Entry | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
tag: ${{ env.TAG }} | |
commit: master | |
generateReleaseNotes: true | |
# Dispatch deployment | |
- name: Deploy Dispatch | |
uses: peter-evans/repository-dispatch@v1 | |
if: ${{ steps.create_release.outcome == 'success' }} | |
with: | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
event-type: deploy | |
client-payload: '{"tag_name": "${{ env.TAG }}"}' |