From 1a0776a2a529dc497f4c1abbb0ffb4f078ce5f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20M=C3=B6ltgen?= <39344769+M123-dev@users.noreply.github.com> Date: Thu, 22 Sep 2022 18:25:28 +0200 Subject: [PATCH] ci: Create internal release on every commit (#2983) * ci: Create internal release on every commit * Added concurrency to avoid dublicate releases * Update .github/workflows/internal-release.yml Co-authored-by: Pierre Slamich Co-authored-by: Pierre Slamich --- ...d-release-to-org-openfoodfacts-scanner.yml | 2 +- .github/workflows/internal-release.yml | 95 +++++++++++++++++++ .github/workflows/release-please.yml | 18 ++-- packages/smooth_app/android/fastlane/Fastfile | 2 +- packages/smooth_app/ios/fastlane/Fastfile | 22 ++--- 5 files changed, 119 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 298804f719e..286b5c175f2 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..390ea15a368 --- /dev/null +++ b/.github/workflows/internal-release.yml @@ -0,0 +1,95 @@ +name: Create internal releases +on: + push: + branches: + - develop + + +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 }} + 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: + concurrency: + group: android-release + cancel-in-progress: true + 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: + concurrency: + group: iOS-release + cancel-in-progress: true + 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..e9e02d14b9f 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 }} @@ -22,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 }} @@ -55,17 +59,14 @@ 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 }}" 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 }} @@ -82,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 }} 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(