Skip to content

Secrets management

Secrets management #18

Workflow file for this run

name: ECR
on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
env:
KO_DOCKER_REPO: public.ecr.aws/njohnstone2
KO_TAGS: ${{ github.ref_name }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Ko builder
uses: imjasonh/[email protected]
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github_ecr
role-session-name: github
aws-region: us-east-1
- name: Log into AWS Public ECR
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- name: Build and push Docker image
run: |
if [[ "$KO_TAGS" == "main" ]]; then
KO_TAGS=latest
elif [[ "$KO_TAGS" =~ ^[0-9]+\/merge$ ]]; then
KO_TAGS=pr-$(echo "$KO_TAGS" | cut -f1 -d"/")
elif [[ "$KO_TAGS" =~ .*"/".* ]]; then
KO_TAGS=$(echo "$KO_TAGS" | tr / -)
fi
make build