From 26d138727e427b2fd2d2685731673b16fa211914 Mon Sep 17 00:00:00 2001 From: "sevastian.zhukov" Date: Thu, 26 Jan 2023 21:43:25 +0700 Subject: [PATCH 1/2] Release snapshot workflow refactoring --- .circleci/config.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c31ce6680ba..572f27cdb53 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,22 @@ workflows: when: not: << pipeline.parameters.mapbox_navigation_native_upstream >> jobs: - - release-snapshot + - release-snapshot-start: + type: approval + filters: + branches: + ignore: + - main + - /release-v.*/ + - release-snapshot: + requires: + - release-snapshot-start + - release-snapshot: + filters: + branches: + only: + - main + - /release-v.*/ - release: filters: tags: @@ -96,20 +111,6 @@ workflows: #---------- COMMANDS ---------- #------------------------------ commands: - check-snapshot-label: - steps: - - run: - name: Check snapshot label - command: | - if [[ -n "$CIRCLE_PULL_REQUEST" ]]; then - PR=$(curl -s $CIRCLE_PULL_REQUEST) - fi - if [[ $CIRCLE_BRANCH == main || $CIRCLE_BRANCH =~ release-v.* || $PR == *"mapbox/mapbox-navigation-android/labels/publish-snapshot"* ]]; then - exit 0 - else - exit 1 - fi - write-workspace: steps: - persist_to_workspace: @@ -777,7 +778,6 @@ jobs: executor: ndk-r22-latest-executor resource_class: medium+ steps: - - check-snapshot-label - checkout - assemble-core-release - assemble-ui-release From 31f736edda876f21184824f63a959e17fa9fe2b2 Mon Sep 17 00:00:00 2001 From: "sevastian.zhukov" Date: Fri, 27 Jan 2023 17:06:41 +0700 Subject: [PATCH 2/2] Add github action trigger release-snapshot job by PR label publish-snapshot --- .github/workflows/run_release_snapshot.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/run_release_snapshot.yml diff --git a/.github/workflows/run_release_snapshot.yml b/.github/workflows/run_release_snapshot.yml new file mode 100644 index 00000000000..ee2ef1ef43c --- /dev/null +++ b/.github/workflows/run_release_snapshot.yml @@ -0,0 +1,18 @@ +name: Run release-snapshot job +on: + pull_request: + types: [ opened, synchronize, labeled ] +jobs: + process: + if: contains(github.event.pull_request.labels.*.name, 'publish-snapshot') + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-20.04 + env: + BRANCH_NAME: ${{ github.head_ref }} + CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }} + steps: + - name: Run release-snapshot job + run: | + curl -X POST -H "Circle-Token: ${CIRCLE_CI_TOKEN}" --header "Content-Type: application/json" --data "{\"build_parameters\":{\"CIRCLE_JOB\":\"release-snapshot\"}}" https://circleci.com/api/v1.1/project/github/mapbox/mapbox-navigation-android/tree/${BRANCH_NAME}