Skip to content

Commit

Permalink
ci: Create internal release on every commit (openfoodfacts#2983)
Browse files Browse the repository at this point in the history
* ci: Create internal release on every commit

* Added concurrency to avoid dublicate releases

* Update .github/workflows/internal-release.yml

Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>

Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>
  • Loading branch information
M123-dev and teolemon authored Sep 22, 2022
1 parent f9af87f commit 1a0776a
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/internal-release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
18 changes: 11 additions & 7 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ 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 }}
release-type: simple
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 }}
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ platform :android do
end

desc "Deploy to internal"
lane :closed_beta do
lane :release do
begin
#gradle(task: "clean")
#gradle(
Expand Down
22 changes: 11 additions & 11 deletions packages/smooth_app/ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 1a0776a

Please sign in to comment.