|
| 1 | +# Written by sdk-codegen (emit_workflow_stubs.py); do not edit by hand. |
| 2 | +# Publishing no longer runs in this repo. The packaging checks, the PyPI upload, |
| 3 | +# the tag and the GitHub release all run centrally in publish-python.yml in |
| 4 | +# Codat SDK Codegen - no check has been dropped, they just moved. This stub |
| 5 | +# only forwards the release trigger there, authenticated with a short-lived |
| 6 | +# token minted from the GitHub App in the PUBLISH_TRIGGER_APP_* secrets. |
| 7 | +# |
| 8 | +# Set the PUBLISH_PRERELEASE Actions variable on this repo to rc1 to make the |
| 9 | +# next merge publish <version>rc1 rather than <version>. A plain |
| 10 | +# `pip install` skips pre-releases, so only people who ask for the rc by name |
| 11 | +# get it. Clear the variable once the real version has been promoted. |
1 | 12 | name: Release Sync for Expenses library |
2 | 13 | 'on': |
3 | 14 | push: |
4 | 15 | paths: |
5 | 16 | - sync-for-expenses/RELEASES.md |
6 | 17 | branches: |
7 | 18 | - main |
| 19 | + workflow_dispatch: {} |
| 20 | +concurrency: publish-sync-for-expenses-python |
8 | 21 | jobs: |
9 | 22 | publish: |
10 | | - uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-publish.yaml@v15 |
11 | | - secrets: |
12 | | - github_access_token: ${{ secrets.GITHUB_TOKEN }} |
13 | | - speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }} |
14 | | - slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} |
15 | | - pypi_token: ${{ secrets.PYPI_TOKEN }} |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Check the App secrets are set |
| 26 | + env: |
| 27 | + APP_ID_SET: ${{ secrets.PUBLISH_TRIGGER_APP_ID != '' }} |
| 28 | + APP_KEY_SET: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY != '' }} |
| 29 | + run: | |
| 30 | + if [ "$APP_ID_SET" != "true" ] || [ "$APP_KEY_SET" != "true" ]; then |
| 31 | + echo "::error::PUBLISH_TRIGGER_APP_ID / PUBLISH_TRIGGER_APP_PRIVATE_KEY secrets are not set - needed to mint the token that sends the publish-python repository dispatch to codat-internal/sdk-codegen" |
| 32 | + exit 1 |
| 33 | + fi |
| 34 | + - name: Mint a token from the GitHub App |
| 35 | + id: app_token |
| 36 | + uses: actions/create-github-app-token@v2 |
| 37 | + with: |
| 38 | + app-id: ${{ secrets.PUBLISH_TRIGGER_APP_ID }} |
| 39 | + private-key: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY }} |
| 40 | + owner: codat-internal |
| 41 | + repositories: sdk-codegen |
| 42 | + - name: Hand the release to the central publish pipeline |
| 43 | + run: | |
| 44 | + curl --fail-with-body --silent --show-error -X POST \ |
| 45 | + -H "Accept: application/vnd.github+json" \ |
| 46 | + -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ |
| 47 | + https://api.github.com/repos/codat-internal/sdk-codegen/dispatches \ |
| 48 | + -d '{"event_type": "publish-python", "client_payload": {"product": "sync-for-expenses", "sha": "${{ github.sha }}", "sdk_repo": "${{ github.repository }}", "prerelease": "${{ vars.PUBLISH_PRERELEASE }}"}}' |
| 49 | + echo "publish-python dispatch sent to codat-internal/sdk-codegen for sync-for-expenses @ ${{ github.sha }}${{ vars.PUBLISH_PRERELEASE && format(' as a {0} pre-release', vars.PUBLISH_PRERELEASE) || '' }}" |
0 commit comments