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