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