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