From a73e274e3627cd03cce87ab55cbb370cf1e88ef9 Mon Sep 17 00:00:00 2001 From: Marvin M <39344769+M123-dev@users.noreply.github.com> Date: Fri, 9 Sep 2022 15:46:25 +0200 Subject: [PATCH 1/3] ci: Create internal release on every commit --- ...d-release-to-org-openfoodfacts-scanner.yml | 2 +- .github/workflows/internal-release.yml | 85 +++++++++++++++++++ .github/workflows/release-please.yml | 9 +- packages/smooth_app/android/fastlane/Fastfile | 2 +- packages/smooth_app/ios/fastlane/Fastfile | 22 ++--- 5 files changed, 100 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/internal-release.yml diff --git a/.github/workflows/android-release-to-org-openfoodfacts-scanner.yml b/.github/workflows/android-release-to-org-openfoodfacts-scanner.yml index 4506423a281..0d881233006 100644 --- a/.github/workflows/android-release-to-org-openfoodfacts-scanner.yml +++ b/.github/workflows/android-release-to-org-openfoodfacts-scanner.yml @@ -93,7 +93,7 @@ jobs: - name: Release AAB uses: maierj/fastlane-action@v2.2.1 with: - lane: closed_beta + lane: release subdirectory: packages/smooth_app/android env: SIGN_STORE_PATH: ./../fastlane/envfiles/keystore.jks diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml new file mode 100644 index 00000000000..5e4d25d890a --- /dev/null +++ b/.github/workflows/internal-release.yml @@ -0,0 +1,85 @@ +name: Create internal releases +on: + push: + branches: + - develop + + +jobs: + tag-commit: + runs-on: ubuntu-latest + outputs: + VERSION_NAME: ${{ steps.set_output.outputs.VERSION_NAME }} + VERSION_CODE: ${{ steps.set_output.outputs.VERSION_CODE }} + + steps: + - uses: actions/checkout@v2 + + # Get the latest version name from file + - name: Set VERSION_NAME env + run: echo "VERSION_NAME=$(cat version.txt)>> $GITHUB_ENV + #run: echo "VERSION_NAME=1.9.0" >> $GITHUB_ENV + + - name: Decrypt Android API JSON file + run: cd ./packages/smooth_app/android/fastlane/envfiles && chmod +x ./decrypt_secrets.sh && ./decrypt_secrets.sh + env: + API_JSON_FILE_DECRYPTKEY: ${{ secrets.API_JSON_FILE_DECRYPTKEY }} + DECRYPT_GPG_KEYSTORE: ${{ secrets.DECRYPT_GPG_KEYSTORE }} + STORE_JKS_DECRYPTKEY: ${{ secrets.NEW_CYPHER }} + + # We are using the android version code for iOS as well to have the version codes in sync + # in order for Sentry and other tools to work properly + # Outputs env: VERSION_CODE (integer) + - name: Get latest VERSION_CODE + uses: maierj/fastlane-action@v2.2.1 + with: + lane: getOldVersionCode + subdirectory: packages/smooth_app/android + + - name: Version + run: echo "${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }}" + + - name: Tag commit + uses: rickstaa/action-create-tag@v1 + with: + tag: "Internal: ${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }}" + message: "Internal release: ${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }}" + + - name: Set output + id: set_output + run: echo "::set-output name=VERSION_NAME::${{ env.VERSION_NAME }}" && echo "::set-output name=VERSION_CODE::${{ env.VERSION_CODE }}" + + android-release: + uses: openfoodfacts/smooth-app/.github/workflows/android-release-main.yml@develop + needs: tag-commit + with: + VERSION_NAME: ${{ needs.create-release.outputs.VERSION_NAME}} + VERSION_CODE: ${{ needs.create-release.outputs.VERSION_CODE}} + FLUTTER-CACHE-KEY: '3.3.x' + secrets: + API_JSON_FILE_DECRYPTKEY: ${{secrets.API_JSON_FILE_DECRYPTKEY }} + DECRYPT_GPG_KEYSTORE: ${{secrets.DECRYPT_GPG_KEYSTORE }} + STORE_JKS_DECRYPTKEY: ${{secrets.NEW_CYPHER }} + SIGN_STORE_PASSWORD: ${{secrets.DECRYPT_FOR_SCANNER_FILE }} + SIGN_KEY_ALIAS: ${{secrets.ALIAS_FOR_SCANNER }} + SIGN_KEY_PASSWORD: ${{secrets.KEY_FOR_SCANNER }} + + iOS-release: + uses: openfoodfacts/smooth-app/.github/workflows/ios-release-main.yml@develop + needs: tag-commit + with: + VERSION_NAME: ${{ needs.create-release.outputs.VERSION_NAME}} + VERSION_CODE: ${{ needs.create-release.outputs.VERSION_CODE}} + FLUTTER-CACHE-KEY: '3.3.x' + secrets: + SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN }} + FASTLANE_USER: ${{secrets.FASTLANE_USER }} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} + MATCH_GIT_BASIC_AUTHORIZATION: ${{secrets.MATCH_GIT_BASIC_AUTHORIZATION }} + MATCH_GIT_URL: ${{secrets.MATCH_GIT_URL }} + MATCH_KEYCHAIN_PASSWORD: ${{secrets.MATCH_KEYCHAIN_PASSWORD }} + MATCH_PASSWORD: ${{secrets.MATCH_PASSWORD }} + PILOT_APPLE_ID: ${{secrets.PILOT_APPLE_ID }} + SPACESHIP_CONNECT_API_ISSUER_ID: ${{secrets.SPACESHIP_CONNECT_API_ISSUER_ID }} + SPACESHIP_CONNECT_API_KEY_ID: ${{secrets.SPACESHIP_CONNECT_API_KEY_ID }} + AUTH_KEY_FILE_DECRYPTKEY: ${{ secrets.AUTH_KEY_FILE_DECRYPTKEY }} \ No newline at end of file diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 46a5122d2f0..e4328214bb8 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -14,7 +14,8 @@ jobs: minor: ${{ steps.release_please.outputs.minor }} patch: ${{ steps.release_please.outputs.patch }} steps: - - uses: google-github-actions/release-please-action@v3 + - name: Release-please + uses: google-github-actions/release-please-action@v3 id: release_please with: token: ${{ secrets.GITHUB_TOKEN }} @@ -55,12 +56,6 @@ jobs: - name: Version run: echo "${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }}" - - name: Tag commit - uses: rickstaa/action-create-tag@v1 - with: - tag: "${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }}" - message: "Release: ${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }}" - - name: Set output id: set_output run: echo "::set-output name=VERSION_NAME::${{ env.VERSION_NAME }}" && echo "::set-output name=VERSION_CODE::${{ env.VERSION_CODE }}" diff --git a/packages/smooth_app/android/fastlane/Fastfile b/packages/smooth_app/android/fastlane/Fastfile index cb992659f91..0fb51b04ae4 100644 --- a/packages/smooth_app/android/fastlane/Fastfile +++ b/packages/smooth_app/android/fastlane/Fastfile @@ -50,7 +50,7 @@ platform :android do end desc "Deploy to internal" - lane :closed_beta do + lane :release do begin #gradle(task: "clean") #gradle( diff --git a/packages/smooth_app/ios/fastlane/Fastfile b/packages/smooth_app/ios/fastlane/Fastfile index 924bc81a006..f43a6ceea82 100644 --- a/packages/smooth_app/ios/fastlane/Fastfile +++ b/packages/smooth_app/ios/fastlane/Fastfile @@ -30,17 +30,17 @@ platform :ios do ) # build your iOS app - gym( - configuration: "Release", - workspace: "Runner.xcworkspace", - scheme: "Runner", - export_method: "app-store", - export_options: { - provisioningProfiles: { - "org.openfoodfacts.scanner" => "match AppStore org.openfoodfacts.scanner", - } - } - ) + #gym( + # configuration: "Release", + # workspace: "Runner.xcworkspace", + # scheme: "Runner", + # export_method: "app-store", + # export_options: { + # provisioningProfiles: { + # "org.openfoodfacts.scanner" => "match AppStore org.openfoodfacts.scanner", + # } + # } + #) # Upload to test flight pilot( From c40fc868ab70bd0b55b8a7d6a222f400fbda4ab0 Mon Sep 17 00:00:00 2001 From: Marvin M <39344769+M123-dev@users.noreply.github.com> Date: Fri, 9 Sep 2022 15:57:14 +0200 Subject: [PATCH 2/3] Added concurrency to avoid dublicate releases --- .github/workflows/internal-release.yml | 10 ++++++++++ .github/workflows/release-please.yml | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index 5e4d25d890a..ed2da50a82b 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -7,6 +7,10 @@ on: jobs: tag-commit: + concurrency: + group: release + cancel-in-progress: true + if: "!contains(github.event.commits[0].message, 'chore(develop): release')" runs-on: ubuntu-latest outputs: VERSION_NAME: ${{ steps.set_output.outputs.VERSION_NAME }} @@ -50,6 +54,9 @@ jobs: run: echo "::set-output name=VERSION_NAME::${{ env.VERSION_NAME }}" && echo "::set-output name=VERSION_CODE::${{ env.VERSION_CODE }}" android-release: + concurrency: + group: android-release + cancel-in-progress: true uses: openfoodfacts/smooth-app/.github/workflows/android-release-main.yml@develop needs: tag-commit with: @@ -65,6 +72,9 @@ jobs: SIGN_KEY_PASSWORD: ${{secrets.KEY_FOR_SCANNER }} iOS-release: + concurrency: + group: iOS-release + cancel-in-progress: true uses: openfoodfacts/smooth-app/.github/workflows/ios-release-main.yml@develop needs: tag-commit with: diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index e4328214bb8..e9e02d14b9f 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -23,6 +23,9 @@ jobs: changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"ci","section":"Automation","hidden":false},{"type":"refactor","section":"Refactoring","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' create-release: + concurrency: + group: release + cancel-in-progress: false runs-on: ubuntu-latest needs: release-please if: ${{ needs.release-please.outputs.release_created }} @@ -61,6 +64,9 @@ jobs: run: echo "::set-output name=VERSION_NAME::${{ env.VERSION_NAME }}" && echo "::set-output name=VERSION_CODE::${{ env.VERSION_CODE }}" android-release: + concurrency: + group: android-release + cancel-in-progress: false uses: openfoodfacts/smooth-app/.github/workflows/android-release-to-org-openfoodfacts-scanner.yml@develop needs: [release-please, create-release] if: ${{ needs.release-please.outputs.release_created }} @@ -77,6 +83,9 @@ jobs: SIGN_KEY_PASSWORD: ${{secrets.KEY_FOR_SCANNER }} iOS-release: + concurrency: + group: iOS-release + cancel-in-progress: false uses: openfoodfacts/smooth-app/.github/workflows/ios-release-to-org-openfoodfacts-scanner.yml@develop needs: [release-please, create-release] if: ${{ needs.release-please.outputs.release_created }} From 993ab2957c3cbcc5bf728fbc08af55f3fbc5d07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20M=C3=B6ltgen?= <39344769+M123-dev@users.noreply.github.com> Date: Sun, 18 Sep 2022 16:46:51 +0200 Subject: [PATCH 3/3] Update .github/workflows/internal-release.yml Co-authored-by: Pierre Slamich --- .github/workflows/internal-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index ed2da50a82b..390ea15a368 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -31,7 +31,7 @@ jobs: DECRYPT_GPG_KEYSTORE: ${{ secrets.DECRYPT_GPG_KEYSTORE }} STORE_JKS_DECRYPTKEY: ${{ secrets.NEW_CYPHER }} - # We are using the android version code for iOS as well to have the version codes in sync + # We are using the Android version code for iOS as well to have the version codes in sync # in order for Sentry and other tools to work properly # Outputs env: VERSION_CODE (integer) - name: Get latest VERSION_CODE