Skip to content

Commit be9ebac

Browse files
committed
feat/CONN-1273-release-stubs: release stubs mint their dispatch token from the GitHub App
- bank_feeds_release.yaml - guard + App token mint (scoped to the codegen repo) before the dispatch - lending_release.yaml - guard + App token mint (scoped to the codegen repo) before the dispatch - platform_release.yaml - guard + App token mint (scoped to the codegen repo) before the dispatch - sync_for_expenses_release.yaml - guard + App token mint (scoped to the codegen repo) before the dispatch - sync_for_payables_release.yaml - guard + App token mint (scoped to the codegen repo) before the dispatch
1 parent 3edece8 commit be9ebac

5 files changed

Lines changed: 95 additions & 25 deletions

File tree

.github/workflows/bank_feeds_release.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Publishing no longer runs in this repo. The packaging checks, the PyPI upload,
33
# the tag and the GitHub release all run centrally in publish-python.yml in
44
# Codat SDK Codegen - no check has been dropped, they just moved. This stub
5-
# only forwards the release trigger there.
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.
67
name: Release Bank Feeds library
78
'on':
89
push:
@@ -16,15 +17,28 @@ jobs:
1617
publish:
1718
runs-on: ubuntu-latest
1819
steps:
19-
- name: Hand the release to the central publish pipeline
20+
- name: Check the App secrets are set
21+
env:
22+
APP_ID_SET: ${{ secrets.PUBLISH_TRIGGER_APP_ID != '' }}
23+
APP_KEY_SET: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY != '' }}
2024
run: |
21-
if [ -z "${{ secrets.PUBLISH_TRIGGER_TOKEN }}" ]; then
22-
echo "::error::PUBLISH_TRIGGER_TOKEN secret is not set - needed to send the publish-python repository dispatch to codat-internal/sdk-codegen"
25+
if [ "$APP_ID_SET" != "true" ] || [ "$APP_KEY_SET" != "true" ]; then
26+
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"
2327
exit 1
2428
fi
29+
- name: Mint a token from the GitHub App
30+
id: app_token
31+
uses: actions/create-github-app-token@v2
32+
with:
33+
app-id: ${{ secrets.PUBLISH_TRIGGER_APP_ID }}
34+
private-key: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY }}
35+
owner: codat-internal
36+
repositories: sdk-codegen
37+
- name: Hand the release to the central publish pipeline
38+
run: |
2539
curl --fail-with-body --silent --show-error -X POST \
2640
-H "Accept: application/vnd.github+json" \
27-
-H "Authorization: Bearer ${{ secrets.PUBLISH_TRIGGER_TOKEN }}" \
41+
-H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \
2842
https://api.github.com/repos/codat-internal/sdk-codegen/dispatches \
2943
-d '{"event_type": "publish-python", "client_payload": {"product": "bank-feeds", "sha": "${{ github.sha }}"}}'
3044
echo "publish-python dispatch sent to codat-internal/sdk-codegen for bank-feeds @ ${{ github.sha }}"

.github/workflows/lending_release.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Publishing no longer runs in this repo. The packaging checks, the PyPI upload,
33
# the tag and the GitHub release all run centrally in publish-python.yml in
44
# Codat SDK Codegen - no check has been dropped, they just moved. This stub
5-
# only forwards the release trigger there.
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.
67
name: Release Lending library
78
'on':
89
push:
@@ -16,15 +17,28 @@ jobs:
1617
publish:
1718
runs-on: ubuntu-latest
1819
steps:
19-
- name: Hand the release to the central publish pipeline
20+
- name: Check the App secrets are set
21+
env:
22+
APP_ID_SET: ${{ secrets.PUBLISH_TRIGGER_APP_ID != '' }}
23+
APP_KEY_SET: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY != '' }}
2024
run: |
21-
if [ -z "${{ secrets.PUBLISH_TRIGGER_TOKEN }}" ]; then
22-
echo "::error::PUBLISH_TRIGGER_TOKEN secret is not set - needed to send the publish-python repository dispatch to codat-internal/sdk-codegen"
25+
if [ "$APP_ID_SET" != "true" ] || [ "$APP_KEY_SET" != "true" ]; then
26+
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"
2327
exit 1
2428
fi
29+
- name: Mint a token from the GitHub App
30+
id: app_token
31+
uses: actions/create-github-app-token@v2
32+
with:
33+
app-id: ${{ secrets.PUBLISH_TRIGGER_APP_ID }}
34+
private-key: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY }}
35+
owner: codat-internal
36+
repositories: sdk-codegen
37+
- name: Hand the release to the central publish pipeline
38+
run: |
2539
curl --fail-with-body --silent --show-error -X POST \
2640
-H "Accept: application/vnd.github+json" \
27-
-H "Authorization: Bearer ${{ secrets.PUBLISH_TRIGGER_TOKEN }}" \
41+
-H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \
2842
https://api.github.com/repos/codat-internal/sdk-codegen/dispatches \
2943
-d '{"event_type": "publish-python", "client_payload": {"product": "lending", "sha": "${{ github.sha }}"}}'
3044
echo "publish-python dispatch sent to codat-internal/sdk-codegen for lending @ ${{ github.sha }}"

.github/workflows/platform_release.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Publishing no longer runs in this repo. The packaging checks, the PyPI upload,
33
# the tag and the GitHub release all run centrally in publish-python.yml in
44
# Codat SDK Codegen - no check has been dropped, they just moved. This stub
5-
# only forwards the release trigger there.
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.
67
name: Release Platform library
78
'on':
89
push:
@@ -16,15 +17,28 @@ jobs:
1617
publish:
1718
runs-on: ubuntu-latest
1819
steps:
19-
- name: Hand the release to the central publish pipeline
20+
- name: Check the App secrets are set
21+
env:
22+
APP_ID_SET: ${{ secrets.PUBLISH_TRIGGER_APP_ID != '' }}
23+
APP_KEY_SET: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY != '' }}
2024
run: |
21-
if [ -z "${{ secrets.PUBLISH_TRIGGER_TOKEN }}" ]; then
22-
echo "::error::PUBLISH_TRIGGER_TOKEN secret is not set - needed to send the publish-python repository dispatch to codat-internal/sdk-codegen"
25+
if [ "$APP_ID_SET" != "true" ] || [ "$APP_KEY_SET" != "true" ]; then
26+
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"
2327
exit 1
2428
fi
29+
- name: Mint a token from the GitHub App
30+
id: app_token
31+
uses: actions/create-github-app-token@v2
32+
with:
33+
app-id: ${{ secrets.PUBLISH_TRIGGER_APP_ID }}
34+
private-key: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY }}
35+
owner: codat-internal
36+
repositories: sdk-codegen
37+
- name: Hand the release to the central publish pipeline
38+
run: |
2539
curl --fail-with-body --silent --show-error -X POST \
2640
-H "Accept: application/vnd.github+json" \
27-
-H "Authorization: Bearer ${{ secrets.PUBLISH_TRIGGER_TOKEN }}" \
41+
-H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \
2842
https://api.github.com/repos/codat-internal/sdk-codegen/dispatches \
2943
-d '{"event_type": "publish-python", "client_payload": {"product": "platform", "sha": "${{ github.sha }}"}}'
3044
echo "publish-python dispatch sent to codat-internal/sdk-codegen for platform @ ${{ github.sha }}"

.github/workflows/sync_for_expenses_release.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Publishing no longer runs in this repo. The packaging checks, the PyPI upload,
33
# the tag and the GitHub release all run centrally in publish-python.yml in
44
# Codat SDK Codegen - no check has been dropped, they just moved. This stub
5-
# only forwards the release trigger there.
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.
67
name: Release Sync for Expenses library
78
'on':
89
push:
@@ -16,15 +17,28 @@ jobs:
1617
publish:
1718
runs-on: ubuntu-latest
1819
steps:
19-
- name: Hand the release to the central publish pipeline
20+
- name: Check the App secrets are set
21+
env:
22+
APP_ID_SET: ${{ secrets.PUBLISH_TRIGGER_APP_ID != '' }}
23+
APP_KEY_SET: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY != '' }}
2024
run: |
21-
if [ -z "${{ secrets.PUBLISH_TRIGGER_TOKEN }}" ]; then
22-
echo "::error::PUBLISH_TRIGGER_TOKEN secret is not set - needed to send the publish-python repository dispatch to codat-internal/sdk-codegen"
25+
if [ "$APP_ID_SET" != "true" ] || [ "$APP_KEY_SET" != "true" ]; then
26+
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"
2327
exit 1
2428
fi
29+
- name: Mint a token from the GitHub App
30+
id: app_token
31+
uses: actions/create-github-app-token@v2
32+
with:
33+
app-id: ${{ secrets.PUBLISH_TRIGGER_APP_ID }}
34+
private-key: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY }}
35+
owner: codat-internal
36+
repositories: sdk-codegen
37+
- name: Hand the release to the central publish pipeline
38+
run: |
2539
curl --fail-with-body --silent --show-error -X POST \
2640
-H "Accept: application/vnd.github+json" \
27-
-H "Authorization: Bearer ${{ secrets.PUBLISH_TRIGGER_TOKEN }}" \
41+
-H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \
2842
https://api.github.com/repos/codat-internal/sdk-codegen/dispatches \
2943
-d '{"event_type": "publish-python", "client_payload": {"product": "sync-for-expenses", "sha": "${{ github.sha }}"}}'
3044
echo "publish-python dispatch sent to codat-internal/sdk-codegen for sync-for-expenses @ ${{ github.sha }}"

.github/workflows/sync_for_payables_release.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Publishing no longer runs in this repo. The packaging checks, the PyPI upload,
33
# the tag and the GitHub release all run centrally in publish-python.yml in
44
# Codat SDK Codegen - no check has been dropped, they just moved. This stub
5-
# only forwards the release trigger there.
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.
67
name: Release Sync for Payables library
78
'on':
89
push:
@@ -16,15 +17,28 @@ jobs:
1617
publish:
1718
runs-on: ubuntu-latest
1819
steps:
19-
- name: Hand the release to the central publish pipeline
20+
- name: Check the App secrets are set
21+
env:
22+
APP_ID_SET: ${{ secrets.PUBLISH_TRIGGER_APP_ID != '' }}
23+
APP_KEY_SET: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY != '' }}
2024
run: |
21-
if [ -z "${{ secrets.PUBLISH_TRIGGER_TOKEN }}" ]; then
22-
echo "::error::PUBLISH_TRIGGER_TOKEN secret is not set - needed to send the publish-python repository dispatch to codat-internal/sdk-codegen"
25+
if [ "$APP_ID_SET" != "true" ] || [ "$APP_KEY_SET" != "true" ]; then
26+
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"
2327
exit 1
2428
fi
29+
- name: Mint a token from the GitHub App
30+
id: app_token
31+
uses: actions/create-github-app-token@v2
32+
with:
33+
app-id: ${{ secrets.PUBLISH_TRIGGER_APP_ID }}
34+
private-key: ${{ secrets.PUBLISH_TRIGGER_APP_PRIVATE_KEY }}
35+
owner: codat-internal
36+
repositories: sdk-codegen
37+
- name: Hand the release to the central publish pipeline
38+
run: |
2539
curl --fail-with-body --silent --show-error -X POST \
2640
-H "Accept: application/vnd.github+json" \
27-
-H "Authorization: Bearer ${{ secrets.PUBLISH_TRIGGER_TOKEN }}" \
41+
-H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \
2842
https://api.github.com/repos/codat-internal/sdk-codegen/dispatches \
2943
-d '{"event_type": "publish-python", "client_payload": {"product": "sync-for-payables", "sha": "${{ github.sha }}"}}'
3044
echo "publish-python dispatch sent to codat-internal/sdk-codegen for sync-for-payables @ ${{ github.sha }}"

0 commit comments

Comments
 (0)