Skip to content

Commit 96bdcc3

Browse files
author
Sevastyan Zhukov
authored
Run release-snapshot workflow on publish-snapshot label (#6843)
1 parent bf322c0 commit 96bdcc3

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

.circleci/config.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ workflows:
3232
when:
3333
not: << pipeline.parameters.mapbox_navigation_native_upstream >>
3434
jobs:
35-
- release-snapshot:
36-
filters:
37-
branches:
38-
only:
39-
- main
40-
- /release-v.*/
35+
- release-snapshot
4136
- release:
4237
filters:
4338
tags:
@@ -101,6 +96,20 @@ workflows:
10196
#---------- COMMANDS ----------
10297
#------------------------------
10398
commands:
99+
check-snapshot-label:
100+
steps:
101+
- run:
102+
name: Check snapshot label
103+
command: |
104+
if [[ -n "$CIRCLE_PULL_REQUEST" ]]; then
105+
PR=$(curl -s $CIRCLE_PULL_REQUEST)
106+
fi
107+
if [[ $CIRCLE_BRANCH == main || $CIRCLE_BRANCH =~ release-v.* || $PR == *"mapbox/mapbox-navigation-android/labels/publish-snapshot"* ]]; then
108+
exit 0
109+
else
110+
exit 1
111+
fi
112+
104113
write-workspace:
105114
steps:
106115
- persist_to_workspace:
@@ -768,6 +777,7 @@ jobs:
768777
executor: ndk-r22-latest-executor
769778
resource_class: medium+
770779
steps:
780+
- check-snapshot-label
771781
- checkout
772782
- assemble-core-release
773783
- assemble-ui-release

gradle/artifact-settings.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ def getSnapshotVersion(String version) {
5252
if (!isPreRelease) {
5353
minor += 1
5454
}
55-
return "${major}.${minor}.0-SNAPSHOT"
55+
def branch = System.getenv("CIRCLE_BRANCH")
56+
if (!branch || branch == "main" || branch ==~ /release-v.*/) {
57+
return "${major}.${minor}.0-SNAPSHOT"
58+
} else {
59+
return "${major}.${minor}.0-${branch}-SNAPSHOT"
60+
}
5661
}
5762
}

0 commit comments

Comments
 (0)