Dummy commit #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build and publish Action Destination package and trigger a buildkite workflow for updating integrations. | |
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Publish Canary | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- add-tar-release-pipeline | |
jobs: | |
build-and-publish: | |
env: | |
HUSKY: 0 | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_PAT }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://registry.npmjs.org' | |
cache: yarn | |
- name: Use Github Personal Access Token | |
run: git config --global url."https://${{ secrets.GH_PAT }}@github.com/".insteadOf ssh://[email protected]/ | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Get Package Version | |
run: | | |
PACKAGE_VERSION=$(node -p "require('./packages/destination-actions/package.json').version") | |
SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8` | |
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV | |
echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_ENV | |
echo "ACTION_DESTINATION_VERSION=${PACKAGE_VERSION}-${SHORT_SHA}" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
NODE_ENV=production yarn build | |
- name: Set NPM Token | |
run: | | |
npm set '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_PUBLISH_TOKEN }} | |
npm whoami | |
- name: Publish Action Destinations | |
run: | | |
yarn cloud publish --tag canary --new-version "${{ env.ACTION_DESTINATION_VERSION }}" --no-git-tag-version | |
- name: Trigger Integrations Pipeline | |
run: | | |
result=$(curl --request POST \ | |
--url https://api.buildkite.com/v2/organizations/segment/pipelines/integrations/builds \ | |
--header 'Authorization: Bearer ${{ secrets.INTEGRATIONS_BUILDKITE_TOKEN }}' \ | |
--header 'Content-Type: application/json' \ | |
--data '{"commit":"HEAD","branch":"ci-test",":github: Update action destination version with action-destinations-${{ env.PACKAGE_VERSION }}-${{ env.SHORT_SHA }}","env":{ | |
"ACTIONS_BRANCH": "${{ github.ref_name }}", "TRIGGERED_FROM_GHA": "true", "ACTION_DESTINATION_ARTIFACT": "action-destinations-${{ env.PACKAGE_VERSION }}-${{ env.SHORT_SHA }}.tgz", "ACTIONS_RUN_ID": "${{ github.run_id }}" },"meta_data":{}}') | |
BUILDKITE_URL=$(echo $result | jq -r '.web_url') | |
if [[ -z "$BUILDKITE_URL"]]; | |
then | |
exit 1 | |
else | |
echo "Build triggered successfuly - ${BUILDKITE_URL}" | |
fi |