From 3e93979245c09e44fed89d9f7485ecea7a2b717f Mon Sep 17 00:00:00 2001 From: Johan Gunnarsson Date: Tue, 16 Aug 2022 22:05:42 +0200 Subject: [PATCH] github: Move Docker deploy to separate workflow --- .github/workflows/ci.yml | 22 ++-------------- .github/workflows/docker.yml | 49 ++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d402740..416890e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..b1566e0 --- /dev/null +++ b/.github/workflows/docker.yml @@ -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