github: Move Docker deploy to separate workflow

This commit is contained in:
Johan Gunnarsson 2022-08-16 22:05:42 +02:00
parent bf687cedd1
commit 3e93979245
2 changed files with 51 additions and 20 deletions

View File

@ -64,7 +64,7 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: boot-qemu_x86_virt-master
path: ${{ runner.temp }}/boot-qemu_x86_virt.bin.gz
path: ${{ runner.temp }}/boot-qemu_x86_virt.bin.gz
if-no-files-found: error
retention-days: 1
@ -152,27 +152,9 @@ jobs:
timeout-minutes: 1
uses: docker/setup-buildx-action@v1
- name: Configure AWS credentials
timeout-minutes: 5
if: github.event_name != 'pull_request' && github.ref_name == 'master'
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
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
timeout-minutes: 30
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
tags: ${{ steps.login-ecr-public.outputs.registry }}/johang/sd-card-images:latest

49
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: docker build and deploy
on:
push:
branches: "master"
permissions:
id-token: write
contents: read
jobs:
deploy-docker:
runs-on: ubuntu-latest
name: build and deploy
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
timeout-minutes: 1
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
timeout-minutes: 1
uses: docker/setup-buildx-action@v1
- name: Configure AWS credentials
timeout-minutes: 5
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: us-east-1
- name: Login to Amazon ECR Public
timeout-minutes: 5
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Build and push
timeout-minutes: 30
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.login-ecr-public.outputs.registry }}/johang/sd-card-images:latest