Skip to content

Commit 22fb015

Browse files
authored
Merge pull request #2349 from aws/migrate-release-workflow-auth
Migrate release workflow auth to deploy key + per-repo FG PAT
2 parents d1d9858 + ebd2950 commit 22fb015

2 files changed

Lines changed: 16 additions & 17 deletions

File tree

.github/workflows/create-release-pr.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ jobs:
3030
with:
3131
role-to-assume: ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_ROLE_ARN }}
3232
aws-region: us-west-2
33-
# Retrieve the Access Token from Secrets Manager
34-
- name: Retrieve secret from AWS Secrets Manager
33+
# Retrieve the per-repo deploy key + FG PAT from Secrets Manager
34+
- name: Retrieve secrets from AWS Secrets Manager
3535
uses: aws-actions/aws-secretsmanager-get-secrets@3a411b6ec5cace3d626412dd917e7bfeac242cfa #v3.0.0
3636
with:
3737
secret-ids: |
38-
AWS_SECRET, ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_NAME }}
39-
parse-json-secrets: true
40-
# Checkout a full clone of the repo
38+
DEPLOY_KEY, prod/devops/aws-lambda-dotnet-deploy-key
39+
FG_PAT, prod/devops/aws-lambda-dotnet-fg-pat
40+
# Checkout a full clone of the repo using the deploy key (push runs over SSH)
4141
- name: Checkout
4242
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4343
with:
4444
fetch-depth: "0"
45-
token: ${{ env.AWS_SECRET_TOKEN }}
45+
ssh-key: ${{ env.DEPLOY_KEY }}
4646
# Install .NET9 which is needed for AutoVer
4747
- name: Setup .NET 9.0
4848
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
@@ -116,9 +116,8 @@ jobs:
116116
# Create the Release PR and label it
117117
- name: Create Pull Request
118118
env:
119-
GITHUB_TOKEN: ${{ env.AWS_SECRET_TOKEN }}
119+
GITHUB_TOKEN: ${{ env.FG_PAT }}
120120
run: |
121-
pr_url="$(gh pr create --title "${{ steps.read-release-name.outputs.VERSION }}" --body "${{ steps.read-changelog.outputs.CHANGELOG }}" --base dev --head ${{ steps.create-release-branch.outputs.BRANCH }})"
122121
gh label create "Release PR" --description "A Release PR that includes versioning and changelog changes" -c "#FF0000" -f
123-
gh pr edit $pr_url --add-label "Release PR"
122+
pr_url="$(gh pr create --title "${{ steps.read-release-name.outputs.VERSION }}" --label "Release PR" --body "${{ steps.read-changelog.outputs.CHANGELOG }}" --base dev --head ${{ steps.create-release-branch.outputs.BRANCH }})"
124123

.github/workflows/sync-master-dev.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ jobs:
3030
with:
3131
role-to-assume: ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_ROLE_ARN }}
3232
aws-region: us-west-2
33-
# Retrieve the Access Token from Secrets Manager
34-
- name: Retrieve secret from AWS Secrets Manager
33+
# Retrieve the per-repo deploy key + FG PAT from Secrets Manager
34+
- name: Retrieve secrets from AWS Secrets Manager
3535
uses: aws-actions/aws-secretsmanager-get-secrets@3a411b6ec5cace3d626412dd917e7bfeac242cfa #v3.0.0
3636
with:
3737
secret-ids: |
38-
AWS_SECRET, ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_NAME }}
39-
parse-json-secrets: true
40-
# Checkout a full clone of the repo
38+
DEPLOY_KEY, prod/devops/aws-lambda-dotnet-deploy-key
39+
FG_PAT, prod/devops/aws-lambda-dotnet-fg-pat
40+
# Checkout a full clone of the repo using the deploy key (push runs over SSH)
4141
- name: Checkout code
4242
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4343
with:
4444
ref: dev
4545
fetch-depth: 0
46-
token: ${{ env.AWS_SECRET_TOKEN }}
46+
ssh-key: ${{ env.DEPLOY_KEY }}
4747
# Install .NET9 which is needed for AutoVer
4848
- name: Setup .NET 9.0
4949
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
@@ -95,7 +95,7 @@ jobs:
9595
# Create the GitHub Release
9696
- name: Create GitHub Release
9797
env:
98-
GITHUB_TOKEN: ${{ env.AWS_SECRET_TOKEN }}
98+
GITHUB_TOKEN: ${{ env.FG_PAT }}
9999
run: |
100100
gh release create "${{ steps.read-tag-name.outputs.TAG }}" --title "${{ steps.read-release-name.outputs.VERSION }}" --notes "${{ steps.read-changelog.outputs.CHANGELOG }}"
101101
# Delete the `releases/next-release` branch
@@ -119,7 +119,7 @@ jobs:
119119
github.event.pull_request.base.ref == 'dev'
120120
runs-on: ubuntu-latest
121121
steps:
122-
# Checkout a full clone of the repo
122+
# Checkout a full clone of the repo using the deploy key (push runs over SSH)
123123
- name: Checkout code
124124
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
125125
with:

0 commit comments

Comments
 (0)