From 7c1793ebc1fd8146df0d6f19ac3be447b954bebb Mon Sep 17 00:00:00 2001 From: Valentin REVERSAT Date: Sun, 21 Apr 2024 12:48:10 +0200 Subject: [PATCH] chore(ci): rework the CI integration - no more dev branch - new pre-release stage added - `beta` versions now clearly visible --- .github/workflows/action.release.yaml | 6 +++++ .github/workflows/push.default.yaml | 1 - .github/workflows/push.main.yaml | 8 ++++--- .../{push.tag.yaml => push.tag-beta.yaml} | 4 +++- .../{push.dev.yaml => push.tag-prod.yaml} | 23 +++++++++---------- .../chabo_about_screen.dart | 10 +++++++- 6 files changed, 34 insertions(+), 18 deletions(-) rename .github/workflows/{push.tag.yaml => push.tag-beta.yaml} (90%) rename .github/workflows/{push.dev.yaml => push.tag-prod.yaml} (66%) diff --git a/.github/workflows/action.release.yaml b/.github/workflows/action.release.yaml index d708b05e..9f1c8ae5 100644 --- a/.github/workflows/action.release.yaml +++ b/.github/workflows/action.release.yaml @@ -2,6 +2,11 @@ name: Action - Release on: workflow_call: + inputs: + is_a_prerelease: + description: 'Specify if this need to be tagged as a pre-release version' + required: true + type: boolean jobs: changelog: @@ -43,6 +48,7 @@ jobs: - name: 'Generate Github release' uses: softprops/action-gh-release@v2 with: + prerelease: ${{ inputs.is_a_prerelease }} name: '${{ github.ref_name }} 🚀' body_path: CHANGELOG.md files: | diff --git a/.github/workflows/push.default.yaml b/.github/workflows/push.default.yaml index 47e6e016..43a6bbd5 100644 --- a/.github/workflows/push.default.yaml +++ b/.github/workflows/push.default.yaml @@ -4,7 +4,6 @@ on: push: branches-ignore: - main - - dev concurrency: group: ci-${{ github.ref }} diff --git a/.github/workflows/push.main.yaml b/.github/workflows/push.main.yaml index 87010c2f..37ae576d 100644 --- a/.github/workflows/push.main.yaml +++ b/.github/workflows/push.main.yaml @@ -15,17 +15,19 @@ jobs: with: flutter_version: '3.19.3' secrets: inherit + page: + uses: ./.github/workflows/action.pages.deploy.yaml flutter-build: needs: [ flutter-test-analyze ] uses: ./.github/workflows/action.flutter.build.yaml with: flutter_version: '3.19.3' android_output: 'aab' - env: 'prd' + env: 'dev' secrets: inherit - fastlane: + fastlane-dry-run: needs: [ flutter-build ] uses: ./.github/workflows/action.fastlane.yaml with: - lane: 'prd' + lane: 'dry_run' secrets: inherit diff --git a/.github/workflows/push.tag.yaml b/.github/workflows/push.tag-beta.yaml similarity index 90% rename from .github/workflows/push.tag.yaml rename to .github/workflows/push.tag-beta.yaml index cb3315c7..edd5f1ff 100644 --- a/.github/workflows/push.tag.yaml +++ b/.github/workflows/push.tag-beta.yaml @@ -3,7 +3,7 @@ name: Tag workflow on: push: tags: - - v* + - 'v[0-9]+.[0-9]+.[0-9]+-beta$' concurrency: group: ci-${{ github.ref }} @@ -26,6 +26,8 @@ jobs: release: needs: [ flutter-build ] uses: ./.github/workflows/action.release.yaml + with: + is_a_prerelease: true fastlane: needs: [ flutter-build ] uses: ./.github/workflows/action.fastlane.yaml diff --git a/.github/workflows/push.dev.yaml b/.github/workflows/push.tag-prod.yaml similarity index 66% rename from .github/workflows/push.dev.yaml rename to .github/workflows/push.tag-prod.yaml index ad59c700..8e993c19 100644 --- a/.github/workflows/push.dev.yaml +++ b/.github/workflows/push.tag-prod.yaml @@ -1,13 +1,9 @@ -name: Dev workflow +name: Main workflow on: push: - branches: - - dev - -concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: true + tags: + - 'v[0-9]+.[0-9]+.[0-9]+$' jobs: flutter-test-analyze: @@ -15,19 +11,22 @@ jobs: with: flutter_version: '3.19.3' secrets: inherit - page: - uses: ./.github/workflows/action.pages.deploy.yaml flutter-build: needs: [ flutter-test-analyze ] uses: ./.github/workflows/action.flutter.build.yaml with: flutter_version: '3.19.3' android_output: 'aab' - env: 'dev' + env: 'prd' secrets: inherit - fastlane-dry-run: + release: + needs: [ flutter-build ] + uses: ./.github/workflows/action.release.yaml + with: + is_a_prerelease: false + fastlane: needs: [ flutter-build ] uses: ./.github/workflows/action.fastlane.yaml with: - lane: 'dry_run' + lane: 'prd' secrets: inherit diff --git a/lib/screens/chabo_about_screen/chabo_about_screen.dart b/lib/screens/chabo_about_screen/chabo_about_screen.dart index 28808956..258282c5 100644 --- a/lib/screens/chabo_about_screen/chabo_about_screen.dart +++ b/lib/screens/chabo_about_screen/chabo_about_screen.dart @@ -30,6 +30,14 @@ class ChaboAboutScreen extends StatelessWidget { ChaboAboutScreen({super.key}); + String _formatBetaVersion(String versionCode) { + if (versionCode.contains('beta')) { + return "${versionCode.split('-')[0]}-β"; + } else { + return versionCode; + } + } + @override Widget build(BuildContext context) { final textTheme = Theme.of(context).textTheme; @@ -143,7 +151,7 @@ class ChaboAboutScreen extends StatelessWidget { ), ), Text( - ' | v${snapshot.data!.version} (${snapshot.data!.buildNumber})', + ' | v${_formatBetaVersion(snapshot.data!.version)} (${snapshot.data!.buildNumber})', style: textTheme.bodyMedium, ), ],