Skip to content

Commit

Permalink
Access buildkite url from repository vars
Browse files Browse the repository at this point in the history
  • Loading branch information
varadarajan-tw committed Oct 13, 2023
1 parent 7b8f1ee commit d0c3b8c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/publish-canary.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# This workflow will build and publish Action Destination package and trigger a buildkite workflow for updating integrations.
# This workflow will build and publish Action Destination package and trigger a buildkite workflow for updating internal service.
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish Canary

on:
# Remove before merging to master
push:
branches:
# Remove before merging to master
- add-tar-release-pipeline
- stage
# Manual trigger
workflow_dispatch:
branches:
- add-tar-release-pipeline
inputs:
integrations_branch:
description: 'The integrations branch to use update. If a branch is not present, a new branch will be created.'
required: true
default: 'stage'
# branches:
# - add-tar-release-pipeline
# # inputs:
# # service_branch:
# # description: 'The service branch to update. If a branch is not present, a new branch will be created.'
# # required: true
# # default: 'stage'

jobs:
build-and-publish:
Expand Down Expand Up @@ -70,14 +72,14 @@ jobs:
run: |
yarn cloud publish --tag canary --new-version "${{ env.ACTION_DESTINATION_VERSION }}" --no-git-tag-version --network-timeout 300000
- name: Trigger Integrations Pipeline
- name: Trigger Buildkite Pipeline
run: |
result=$(curl --request POST \
--url https://api.buildkite.com/v2/organizations/segment/pipelines/integrations/builds \
--header 'Authorization: Bearer ${{ secrets.INTEGRATIONS_BUILDKITE_TOKEN }}' \
--url {{ vars.BUILDKITE_PIPELINE_URL }} \
--header 'Authorization: Bearer ${{ secrets.BUILDKITE_TOKEN }}' \
--header 'Content-Type: application/json' \
--data '{"commit":"HEAD","branch":"ci-test", "message": ":github: bump @segment/action-destinations action destination version to ${{ env.ACTION_DESTINATION_VERSION }}","env":{
"BRANCH_TO_UPDATE": "${{ github.event.inputs.integrations_branch }}", "SHORT_SHA": "${{ env.SHORT_SHA }}", "WEEKLY_DEPLOY": "false", "UPGRADE_ACTION_DESTINATIONS": "true", "ACTION_DESTINATIONS_VERSION": "${{ env.ACTION_DESTINATION_VERSION }}", "ACTIONS_RUN_ID": "${{ github.run_id }}" },"meta_data":{}}')
"BRANCH_TO_UPDATE": "${{ github.ref_name }}", "SHORT_SHA": "${{ env.SHORT_SHA }}", "WEEKLY_DEPLOY": "false", "UPGRADE_ACTION_DESTINATIONS": "true", "ACTION_DESTINATIONS_VERSION": "${{ env.ACTION_DESTINATION_VERSION }}", "ACTIONS_RUN_ID": "${{ github.run_id }}" },"meta_data":{}}')
BUILDKITE_URL=$(echo $result | jq -r '.web_url')
if [[ "$BUILDKITE_URL" -eq null ]]; then
echo "Failed to trigger integrations pipeline. Reason:$(echo $result | jq -r '.message'))"
Expand Down

0 comments on commit d0c3b8c

Please sign in to comment.