Skip to content

Commit ce85d69

Browse files
committed
change to logic
1 parent 65700b8 commit ce85d69

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/actions/generate-version-code/action.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ runs:
7474
shell: bash
7575

7676
- name: Compute VERSIONCODE (iOS)
77+
id: compute-versioncode-ios
7778
if: ${{ inputs.os == 'ios' }}
7879
shell: bash
7980
run: |
80-
bundle exec fastlane ios get_testflight_version
81+
VERSIONCODE=$(bundle exec fastlane ios get_testflight_version | tail -n1)
82+
echo "LATEST_VERSIONCODE=$VERSIONCODE" >> $GITHUB_OUTPUT
8183
working-directory: ios
8284
env:
8385
MATCH_KEYCHAIN_NAME: ${{ inputs.MATCH_KEYCHAIN_NAME }}
@@ -88,22 +90,21 @@ runs:
8890
FASTLANE_REPO_PAT: ${{ inputs.FASTLANE_REPO_PAT }}
8991

9092
- name: Compute VERSIONCODE (Android)
93+
id: compute-versioncode-android
9194
if: ${{ inputs.os == 'android' }}
9295
shell: bash
9396
run: |
94-
bundle exec fastlane android version_code
97+
VERSIONCODE=$(bundle exec fastlane android version_code | tail -n1)
98+
echo "LATEST_VERSIONCODE=$VERSIONCODE" >> $GITHUB_OUTPUT
9599
working-directory: android
96100

97101
- name: Compute VERSIONCODE
98102
id: compute
99103
shell: bash
100104
env:
101-
GITHUB_RUN_NUMBER: ${{ github.run_number }}
105+
LATEST_VERSIONCODE: ${{ steps.compute-versioncode-ios.outputs.LATEST_VERSIONCODE }} || ${{ steps.compute-versioncode-android.outputs.LATEST_VERSIONCODE }}
102106
run: |
103-
# This offset is from CircleCI after we migrated to Github Actions in order to have sequential builds
104-
105-
OFFSET=92000
106-
VERSIONCODE=$((OFFSET + GITHUB_RUN_NUMBER))
107+
VERSIONCODE=$((LATEST_VERSIONCODE + 1))
107108
echo "VERSIONCODE=$VERSIONCODE" >> $GITHUB_OUTPUT
108109
109110
echo "### 📦 Version Code Generated" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)