From 8965c0e4769f3cc8959e0d5328b9b0765fd73f68 Mon Sep 17 00:00:00 2001 From: tomiir Date: Tue, 5 Nov 2024 18:17:45 +0100 Subject: [PATCH] feat: re add publish canary workflow (#3202) --- .github/workflows/publish_canary.yml | 64 ++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/publish_canary.yml diff --git a/.github/workflows/publish_canary.yml b/.github/workflows/publish_canary.yml new file mode 100644 index 0000000000..71f097547c --- /dev/null +++ b/.github/workflows/publish_canary.yml @@ -0,0 +1,64 @@ +ame: Publish Canary Image +on: + workflow_dispatch: + push: + branches: + - main + +concurrency: ${{ github.workflow }} + +env: + TERM: linux + +jobs: + push: + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ECR_DEPLOYER }} + aws-region: ${{ vars.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + with: + mask-password: 'true' + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Build, tag, and push image to Amazon ECR + uses: docker/build-push-action@v5 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: web3modal-canary + IMAGE_TAG: V4 + with: + context: . + file: Dockerfile.canary + push: true + tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache