Skip to content

Commit 556cb12

Browse files
committed
Fix increment project version GitHub Action not using sent parameter
Bitrise does not override an envvar sent through URL, so the GitHub Action doesn't take the parameter sent, so it always does a `patch` version increment. With this change (suggested by Bitrise itself), GitHub sends a `GITHUB_VERSION_INCREMENT_TYPE` which then updates the actual `VERSION_INCREMENT_TYPE` in Bitrise. It's a convoluted approach but there's no other way of doing it. MOB-1610
1 parent ea7fdb1 commit 556cb12

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

.github/workflows/increment-project-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
- uses: actions/checkout@v3
1919
- name: Runs the increment project version workflow in Bitrise
2020
run: |
21-
curl https://app.bitrise.io/app/${{ secrets.BITRISE_APP_ID }}/build/start.json --data '{"hook_info":{"type":"bitrise","build_trigger_token":"${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}"},"build_params":{"branch":"master","workflow_id":"authenticated_increment_project_version","environments":[{"mapped_to":"VERSION_INCREMENT_TYPE","value":"${{ github.event.inputs.type }}","is_expand":true}]},"triggered_by":"curl"}'
21+
curl https://app.bitrise.io/app/${{ secrets.BITRISE_APP_ID }}/build/start.json --data '{"hook_info":{"type":"bitrise","build_trigger_token":"${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}"},"build_params":{"branch":"master","workflow_id":"authenticated_increment_project_version","environments":[{"mapped_to":"GITHUB_VERSION_INCREMENT_TYPE","value":"${{ github.event.inputs.type }}","is_expand":true}]},"triggered_by":"curl"}'

bitrise.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ project_type: android
55
workflows:
66
_increment_project_version:
77
steps:
8+
- script@1:
9+
inputs:
10+
- content: >-
11+
#!/usr/bin/env bash
12+
13+
# fail if any commands fails
14+
15+
set -e
16+
17+
# make pipelines' return status equal the last command to exit with
18+
a non-zero status, or zero if all commands exit successfully
19+
20+
set -o pipefail
21+
22+
# debug log
23+
24+
set -x
25+
26+
27+
if [ ! -z "$GITHUB_VERSION_INCREMENT_TYPE" ] ; then
28+
envman add --key VERSION_INCREMENT_TYPE --value "$GITHUB_VERSION_INCREMENT_TYPE"
29+
fi
830
- gradle-runner@2:
931
inputs:
1032
- gradle_file: $PROJECT_LOCATION/build.gradle
@@ -62,6 +84,9 @@ workflows:
6284
- opts:
6385
is_expand: false
6486
INTEGRATOR_VARIANT: debug
87+
- opts:
88+
is_expand: false
89+
VERSION_INCREMENT_TYPE: patch
6590
authenticated_increment_project_version:
6691
description: Task builds an SDK and uploads it to Nexus.
6792
steps:
@@ -74,10 +99,6 @@ workflows:
7499
- cache-push@2: {}
75100
after_run:
76101
- _increment_project_version
77-
envs:
78-
- opts:
79-
is_expand: false
80-
VERSION_INCREMENT_TYPE: patch
81102
browserstack_upload:
82103
steps:
83104
- activate-ssh-key@4:

0 commit comments

Comments
 (0)