Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix secret naming #2820

Merged
merged 1 commit into from
Aug 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
FLUTTER-CACHE-KEY:
required: true
type: string
OLD_VERSION_CODE:
VERSION_CODE:
required: true
type: string
secrets:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
env:
API_JSON_FILE_DECRYPTKEY: ${{ secrets.API_JSON_FILE_DECRYPTKEY }}
DECRYPT_GPG_KEYSTORE: ${{ secrets.DECRYPT_GPG_KEYSTORE }}
STORE_JKS_DECRYPTKEY: ${{ secrets.NEW_CYPHER }}
STORE_JKS_DECRYPTKEY: ${{ secrets.STORE_JKS_DECRYPTKEY }}

- name: Setup Flutter
uses: subosito/flutter-action@v2
Expand All @@ -78,15 +78,15 @@ jobs:
subdirectory: packages/smooth_app/android
env:
VERSION_NAME: ${{ env.VERSION_NAME }}
VERSION_CODE: ${{ env.OLD_VERSION_CODE }}
VERSION_CODE: ${{ env.VERSION_CODE }}

- name: Build AAB
run: echo $SIGN_STORE_PATH && pwd && cd ./packages/smooth_app/ && pwd && flutter build appbundle --release
env:
SIGN_STORE_PATH: ./../fastlane/envfiles/keystore.jks
SIGN_STORE_PASSWORD: ${{ secrets.DECRYPT_FOR_SCANNER_FILE }}
SIGN_KEY_ALIAS: ${{ secrets.ALIAS_FOR_SCANNER }}
SIGN_KEY_PASSWORD: ${{ secrets.KEY_FOR_SCANNER }}
SIGN_STORE_PASSWORD: ${{ secrets.SIGN_STORE_PASSWORD }}
SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }}
SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}

# - name: Release AAB
# uses: maierj/fastlane-action@v2.2.1
Expand All @@ -95,7 +95,7 @@ jobs:
# subdirectory: packages/smooth_app/android
# env:
# SIGN_STORE_PATH: ./../fastlane/envfiles/keystore.jks
# SIGN_STORE_PASSWORD: ${{ secrets.DECRYPT_FOR_SCANNER_FILE }}
# SIGN_KEY_ALIAS: ${{ secrets.ALIAS_FOR_SCANNER }}
# SIGN_KEY_PASSWORD: ${{ secrets.KEY_FOR_SCANNER }}
# SIGN_STORE_PASSWORD: ${{ secrets.SIGN_STORE_PASSWORD }}
# SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }}
# SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
VERSION_NAME:
required: true
type: string
OLD_VERSION_CODE:
VERSION_CODE:
required: true
type: string
secrets:
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
subdirectory: packages/smooth_app/android
env:
VERSION_NAME: ${{ env.VERSION_NAME }}
OLD_VERSION_CODE: ${{ env.OLD_VERSION_CODE }}
VERSION_CODE: ${{ env.VERSION_CODE }}

- name: Build app
run: cd ./packages/smooth_app && cd ios && pod update Sentry && cd .. && flutter build ios --release --no-codesign
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
if: ${{ needs.release-please.outputs.release_created }}
outputs:
VERSION_NAME: ${{ steps.set_output.outputs.VERSION_NAME }}
OLD_VERSION_CODE: ${{ steps.set_output.outputs.OLD_VERSION_CODE }}
VERSION_CODE: ${{ steps.set_output.outputs.VERSION_CODE }}

steps:
- uses: actions/checkout@v2
Expand All @@ -46,33 +46,33 @@ jobs:

# 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: OLD_VERSION_CODE
- name: Get latest OLD_VERSION_CODE
# 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 }}
run: echo "${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }}"

- name: Tag commit
uses: rickstaa/action-create-tag@v1
with:
tag: ${{ env.VERSION_NAME }}
message: "Release: ${{ env.VERSION_NAME }}+${{ env.OLD_VERSION_CODE }} (+1)"
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=OLD_VERSION_CODE::${{ env.OLD_VERSION_CODE }}"
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-to-org-openfoodfacts-scanner.yml@develop
needs: [release-please, create-release]
if: ${{ needs.release-please.outputs.release_created }}
with:
VERSION_NAME: ${{ needs.create-release.outputs.VERSION_NAME}}
OLD_VERSION_CODE: ${{ needs.create-release.outputs.OLD_VERSION_CODE}}
VERSION_CODE: ${{ needs.create-release.outputs.VERSION_CODE}}
FLUTTER-CACHE-KEY: '3.0.1'
secrets:
API_JSON_FILE_DECRYPTKEY: ${{secrets.API_JSON_FILE_DECRYPTKEY }}
Expand All @@ -88,7 +88,7 @@ jobs:
if: ${{ needs.release-please.outputs.release_created }}
with:
VERSION_NAME: ${{ needs.create-release.outputs.VERSION_NAME}}
OLD_VERSION_CODE: ${{ needs.create-release.outputs.OLD_VERSION_CODE}}
VERSION_CODE: ${{ needs.create-release.outputs.VERSION_CODE}}
FLUTTER-CACHE-KEY: '3.0.1'
secrets:
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN }}
Expand Down
18 changes: 9 additions & 9 deletions packages/smooth_app/android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,34 @@ default_platform(:android)

platform :android do

desc "Stores the last used version code on the playstore in env: OLD_VERSION_CODE, is used for all platforms to keep this in sync"
desc "Stores the last used version code + 1 on the playstore in env: VERSION_CODE, is used for all platforms to keep this in sync"
lane :getOldVersionCode do
begin
old_version_code = google_play_track_version_codes(
package_name: "org.openfoodfacts.scanner",
track: "internal",
json_key: "./fastlane/envfiles/api-4712693179220384697-162836-33ea08672303.json",
).to_s
).last().to_i
puts "old_version_code: " + old_version_code.to_s
sh("echo OLD_VERSION_CODE=#{old_version_code} >> $GITHUB_ENV")
version_code = old_version_code.to_i + 1
version_code = version_code.to_s
sh("echo VERSION_CODE=#{version_code} >> $GITHUB_ENV")
end
end

desc "Set's version to env:VERSION_NAME and the version code to env:OLD_VERSION_CODE + 1 used for android + iOS"
desc "Set's version to env:VERSION_NAME and the version code env:VERSION_CODE used for android + iOS"
lane :setVersion do
begin
old_version_code = ENV["OLD_VERSION_CODE"]
puts "old_version_code: " + old_version_code.to_s
new_version_code = old_version_code.last().to_i + 1
puts "new_version_code: " + new_version_code.to_s
version_code = ENV["VERSION_CODE"]
puts "version_code: " + version_code.to_s

new_version_name = ENV["VERSION_NAME"]
puts new_version_name

flutter_set_version(
path_to_yaml: "../pubspec.yaml",
version_name: new_version_name.to_s,
version_code: new_version_code.to_s,
version_code: version_code.to_s,
)
end
end
Expand Down