github: Deploy to AWS ECR Public instead of Docker Hub

This commit is contained in:
Johan Gunnarsson 2022-08-01 19:06:23 +02:00
parent 4fe27f05c0
commit 4b7ace10fb
1 changed files with 21 additions and 5 deletions

View File

@ -9,6 +9,10 @@ on:
schedule: schedule:
- cron: "00 03 * * 0" - cron: "00 03 * * 0"
permissions:
id-token: write
contents: read
env: env:
MAKEFLAGS: -j2 MAKEFLAGS: -j2
@ -144,22 +148,34 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up QEMU - name: Set up QEMU
timeout-minutes: 1
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx - name: Set up Docker Buildx
timeout-minutes: 1
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Login - name: Configure AWS credentials
timeout-minutes: 5
if: github.event_name != 'pull_request' && github.ref_name == 'master' if: github.event_name != 'pull_request' && github.ref_name == 'master'
uses: docker/login-action@v1 uses: aws-actions/configure-aws-credentials@v1
with: with:
username: johang role-to-assume: ${{ secrets.AWS_ROLE }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} aws-region: us-east-1
- name: Login to Amazon ECR Public
timeout-minutes: 5
if: github.event_name != 'pull_request' && github.ref_name == 'master'
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Build and push - name: Build and push
timeout-minutes: 30
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }} push: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
tags: johang/sd-card-images:latest tags: ${{ steps.login-ecr-public.outputs.registry }}/johang/sd-card-images:latest