Skip to content

Commit d9ffd7d

Browse files
authored
Merge pull request #254 from BitGo/WCN-1101-ghcr-fix
feat: AWM release now auto triggers demo-kms-release as well
2 parents 95a2371 + 10e8df0 commit d9ffd7d

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/release-to-ghcr.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,33 @@ jobs:
116116
VCS_REF=${{ github.sha }}
117117
cache-from: type=gha
118118
cache-to: type=gha,mode=max
119+
120+
trigger-demo-kms-api-release:
121+
name: Trigger demo-kms-api release to GHCR
122+
needs: [release, trivy-scan]
123+
runs-on: ubuntu-latest
124+
environment: prod
125+
steps:
126+
- name: Get GitHub token
127+
id: get-github-token
128+
uses: BitGo/build-system/get-github-token@v6
129+
with:
130+
vault-cf-access-client-id: ${{ vars.VAULT_CF_ACCESS_CLIENT_ID }}
131+
vault-cf-access-client-secret: ${{ secrets.VAULT_CF_ACCESS_CLIENT_SECRET }}
132+
repositories: '["demo-kms-api"]'
133+
134+
- name: Trigger and wait for demo-kms-api release to GHCR
135+
run: |
136+
set -euo pipefail
137+
BEFORE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
138+
gh workflow run "release-to-ghcr.yaml" --repo "BitGo/demo-kms-api" --ref "main"
139+
sleep 10
140+
RUN_ID=$(gh run list --repo "BitGo/demo-kms-api" --workflow "release-to-ghcr.yaml" --limit 5 --json databaseId,createdAt --jq "[.[] | select(.createdAt >= \"$BEFORE\")] | .[0].databaseId")
141+
if [ -z "$RUN_ID" ] || [ "$RUN_ID" = "null" ]; then
142+
echo "Could not find the triggered workflow run in BitGo/demo-kms-api"
143+
exit 1
144+
fi
145+
echo "Watching run $RUN_ID in BitGo/demo-kms-api..."
146+
gh run watch "$RUN_ID" --repo "BitGo/demo-kms-api" --exit-status
147+
env:
148+
GH_TOKEN: ${{ steps.get-github-token.outputs.token }}

0 commit comments

Comments
 (0)