Skip to content

Use authentication with GitHub IDP for the AWS role which can publish a new container image in AWS ECR #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/publish-production-image.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Publish PRODUCTION image

permissions:
id-token: write # Required for OIDC authentication
contents: read # Standard permission for GitHub Actions

on:
workflow_dispatch:

Expand Down Expand Up @@ -52,11 +56,10 @@ jobs:
git tag $NEW_TAG
git push origin $NEW_TAG

- name: Configure AWS credentials
- name: Authenticate with AWS ECR account for pushing the image
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PUBLICECR_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PUBLICECR_UPLOAD_SECRET_ACCESS_KEY }}
role-to-assume: ${{ vars.AWS_ECR_PUBLISH_ROLE_ARN }}
aws-region: ${{ vars.PUBLICECR_REGION }}

- name: Authenticate with AWS Public ECR
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/publish-staging-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Configure AWS credentials
- name: Authenticate with AWS ECR account for pushing the image
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PUBLICECR_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PUBLICECR_UPLOAD_SECRET_ACCESS_KEY }}
role-to-assume: ${{ vars.AWS_ECR_PUBLISH_ROLE_ARN }}
aws-region: ${{ vars.PUBLICECR_REGION }}

- name: Authenticate with AWS ECR
Expand Down
Loading