Skip to content

Commit bbfb212

Browse files
author
sangeet-joy_xero
committed
Deploy track changes
1 parent 1a7974d commit bbfb212

File tree

1 file changed

+58
-3
lines changed

1 file changed

+58
-3
lines changed

.github/workflows/publish.yml

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
name: Publish
1+
name: Publish & Release SDK
22
on:
3-
release:
4-
types: [published]
3+
workflow_dispatch:
4+
inputs:
5+
cab_id:
6+
description: "CAB id for the change/release"
7+
required: true
8+
type: string
59

610
jobs:
711
publish:
@@ -106,3 +110,54 @@ jobs:
106110
button_type: "danger"
107111
package_version: ${{needs.publish.outputs.release_number}}
108112
repo_link: ${{github.server_url}}/${{github.repository}}
113+
114+
notify-codegen-repo:
115+
needs: publish
116+
if: always()
117+
runs-on: ubuntu-latest
118+
permissions:
119+
contents: write
120+
pull-requests: write
121+
122+
steps:
123+
- name: Checkout
124+
uses: actions/checkout@v4
125+
with:
126+
repository: XeroAPI/xero-node
127+
path: xero-node
128+
129+
- name: Install octokit dependencies
130+
run: npm i
131+
working-directory: ${{ github.workspace }}/.github/octokit
132+
133+
- name: Get github app access token
134+
id: get_access_token
135+
env:
136+
GITHUB_APP_ID: ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_ID }}
137+
GITHUB_APP_PRIVATE_KEY: ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_KEY }}
138+
uses: actions/github-script@v7
139+
with:
140+
result-encoding: string
141+
script: |
142+
const { getAccessToken } = await import('${{ github.workspace }}/.github/octokit/index.js')
143+
const token = await getAccessToken()
144+
return token
145+
146+
- name: Notify codegen repo
147+
run: |
148+
curl -X POST -H "Authorization: token ${{ steps.get_access_token.outputs.result }}" \
149+
-H "Accept: application/vnd.github.v3+json" \
150+
-H "Content-Type: application/json" \
151+
https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/notify-sdk-publish.yml/dispatches \
152+
-d '{
153+
"ref": "deploy-track-pipeline-changes",
154+
"inputs": {
155+
"commit": "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}",
156+
"status": "${{needs.publish.result}}",
157+
"deployer": "xero-codegen-bot",
158+
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
159+
"environment": "test",
160+
"sdk_type": "node",
161+
"cab_key": ${{ github.event.inputs.cab_id }}
162+
}
163+
}'

0 commit comments

Comments
 (0)