11name : Publish
22on :
3- release :
4- types : [published]
3+ # release:
4+ # types: [published]
5+ push :
6+ branches :
7+ - ' **'
58
69jobs :
710 publish :
@@ -18,84 +21,134 @@ jobs:
1821 repository : XeroAPI/xero-node
1922 path : xero-node
2023
21- - name : Set up Node environment
22- uses : actions/setup-node@v4
23- with :
24- node-version : 20
25- cache : ' npm'
26- cache-dependency-path : ' **/package-lock.json'
27- registry-url : ' https://registry.npmjs.org'
24+ # - name: Set up Node environment
25+ # uses: actions/setup-node@v4
26+ # with:
27+ # node-version: 20
28+ # cache: 'npm'
29+ # cache-dependency-path: '**/package-lock.json'
30+ # registry-url: 'https://registry.npmjs.org'
2831
29- - name : Install dependencies
30- run : npm ci
31- working-directory : xero-node
32+ # - name: Install dependencies
33+ # run: npm ci
34+ # working-directory: xero-node
3235
33- - name : Run Build
34- run : npm run build
35- working-directory : xero-node
36+ # - name: Run Build
37+ # run: npm run build
38+ # working-directory: xero-node
3639
37- - name : Fetch Latest release number
38- id : get_latest_release_number
39- run : |
40- latest_version=$(gh release view --json tagName --jq '.tagName')
41- echo "Latest release version is - $latest_version"
42- echo "::set-output name=release_tag::$latest_version"
43- working-directory : xero-node
44- env :
45- GH_TOKEN : ${{secrets.GITHUB_TOKEN}}
40+ # - name: Fetch Latest release number
41+ # id: get_latest_release_number
42+ # run: |
43+ # latest_version=$(gh release view --json tagName --jq '.tagName')
44+ # echo "Latest release version is - $latest_version"
45+ # echo "::set-output name=release_tag::$latest_version"
46+ # working-directory: xero-node
47+ # env:
48+ # GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
4649
47- - name : Publish to npm
48- env :
49- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
50- run : npm publish
51- working-directory : xero-node
50+ # - name: Publish to npm
51+ # env:
52+ # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
53+ # run: npm publish
54+ # working-directory: xero-node
5255
53- notify-slack-on-success :
54- runs-on : ubuntu-latest
56+ notify-codegen-repo :
5557 needs : publish
58+ runs-on : ubuntu-latest
5659 permissions :
57- contents : read
58- if : success()
60+ contents : write
61+ pull-requests : write
62+
5963 steps :
60- - name : Checkout xero-node repo
64+ - name : Checkout
6165 uses : actions/checkout@v4
62- with :
63- repository : XeroAPI/xero-node
64- path : xero-node
66+ # with:
67+ # repository: XeroAPI/xero-node
68+ # path: xero-node
6569
66- - name : Send slack notification on success
67- uses : ./xero-node/.github/actions/notify-slack
68- with :
69- heading_text : " Publish job has succeeded !"
70- alert_type : " thumbsup"
71- job_status : " Success"
72- XERO_SLACK_WEBHOOK_URL : ${{secrets.XERO_SLACK_WEBHOOK_URL}}
73- job_url : " https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
74- button_type : " primary"
75- package_version : ${{needs.publish.outputs.release_number}}
76- repo_link : ${{github.server_url}}/${{github.repository}}
70+ - name : Install octokit dependencies
71+ run : npm i
72+ working-directory : ${{ github.workspace }}/.github/octokit
7773
78- notify-slack-on-failure :
79- runs-on : ubuntu-latest
80- needs : publish
81- permissions :
82- contents : read
83- if : failure()
84- steps :
85- - name : Checkout xero-node repo
86- uses : actions/checkout@v4
74+ - name : Get github app access token
75+ id : get_access_token
76+ env :
77+ GITHUB_APP_ID : ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_ID }}
78+ GITHUB_APP_PRIVATE_KEY : ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_KEY }}
79+ uses : actions/github-script@v7
8780 with :
88- repository : XeroAPI/xero-node
89- path : xero-node
81+ result-encoding : string
82+ script : |
83+ const { getAccessToken } = await import('${{ github.workspace }}/.github/octokit/index.js')
84+ const token = await getAccessToken()
85+ return token
9086
91- - name : Send slack notification on failure
92- uses : ./xero-node/.github/actions/notify-slack
93- with :
94- heading_text : " Publish job has failed !"
95- alert_type : " alert"
96- job_status : " Failed"
97- XERO_SLACK_WEBHOOK_URL : ${{secrets.XERO_SLACK_WEBHOOK_URL}}
98- job_url : " https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
99- button_type : " danger"
100- package_version : ${{needs.publish.outputs.release_number}}
101- repo_link : ${{github.server_url}}/${{github.repository}}
87+ - name : Notify codegen repo
88+ run : |
89+ curl -X POST -H "Authorization: token ${{ steps.get_access_token.outputs.result }}" \
90+ -H "Accept: application/vnd.github.v3+json" \
91+ -H "Content-Type: application/json" \
92+ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/notify-sdk-publish.yml/dispatches \
93+ -d '{
94+ "ref": "deploy-track-pipeline-changes",
95+ "inputs": {
96+ "commit": "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}",
97+ "status": "${{needs.publish.result}}",
98+ "deployer": "xero-codegen-bot",
99+ "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
100+ "environment": "test",
101+ "sdk_type": "node",
102+ "cab_key": "CAB-5505"
103+ }
104+ }'
105+
106+ # notify-slack-on-success:
107+ # runs-on: ubuntu-latest
108+ # needs: publish
109+ # permissions:
110+ # contents: read
111+ # if: success()
112+ # steps:
113+ # - name: Checkout xero-node repo
114+ # uses: actions/checkout@v4
115+ # with:
116+ # repository: XeroAPI/xero-node
117+ # path: xero-node
118+
119+ # - name: Send slack notification on success
120+ # uses: ./xero-node/.github/actions/notify-slack
121+ # with:
122+ # heading_text: "Publish job has succeeded !"
123+ # alert_type: "thumbsup"
124+ # job_status: "Success"
125+ # XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}
126+ # job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
127+ # button_type: "primary"
128+ # package_version: ${{needs.publish.outputs.release_number}}
129+ # repo_link: ${{github.server_url}}/${{github.repository}}
130+
131+ # notify-slack-on-failure:
132+ # runs-on: ubuntu-latest
133+ # needs: publish
134+ # permissions:
135+ # contents: read
136+ # if: failure()
137+ # steps:
138+ # - name: Checkout xero-node repo
139+ # uses: actions/checkout@v4
140+ # with:
141+ # repository: XeroAPI/xero-node
142+ # path: xero-node
143+
144+ # - name: Send slack notification on failure
145+ # uses: ./xero-node/.github/actions/notify-slack
146+ # with:
147+ # heading_text: "Publish job has failed !"
148+ # alert_type: "alert"
149+ # job_status: "Failed"
150+ # XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}
151+ # job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
152+ # button_type: "danger"
153+ # package_version: ${{needs.publish.outputs.release_number}}
154+ # repo_link: ${{github.server_url}}/${{github.repository}}
0 commit comments