From 2f7b70516cf5255089eeb020a3d08b54ab90005d Mon Sep 17 00:00:00 2001 From: Sudhanshu Pandey Date: Fri, 2 Feb 2024 03:58:14 -0500 Subject: [PATCH] fix: ecs github action (#1992) --- .github/workflows/ecs-deployment.yml | 35 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ecs-deployment.yml b/.github/workflows/ecs-deployment.yml index 06df3a91e7..fb21bf8ea5 100644 --- a/.github/workflows/ecs-deployment.yml +++ b/.github/workflows/ecs-deployment.yml @@ -15,7 +15,7 @@ env: # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io # github.repository as / - IMAGE_NAME: formbricks-experimental + IMAGE_NAME: formbricks/formbricks-experimental DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/formbricks?schema=public" jobs: @@ -66,14 +66,16 @@ jobs: uses: docker/metadata-action@v5 # v5.0.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=sha,format=long + type=raw,value=latest,enable={{is_default_branch}} # Build and push Docker image with Buildx - # https://github.com/docker/build-push-action - name: Build and push Docker image id: build-and-push uses: depot/build-push-action@v1 - env: + env: NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN }} with: project: tw0fqmsx3c @@ -81,6 +83,7 @@ jobs: context: . file: ./apps/web/Dockerfile platforms: linux/amd64,linux/arm64 + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha @@ -90,16 +93,20 @@ jobs: DATABASE_URL=${{ env.DATABASE_URL }} ENCRYPTION_KEY=${{ env.ENCRYPTION_KEY }} NEXT_PUBLIC_SENTRY_DSN=${{ env.NEXT_PUBLIC_SENTRY_DSN }} - - - name: Sign the published Docker image - env: - # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable - TAGS: ${{ steps.meta.outputs.tags }} - DIGEST: ${{ steps.build-and-push.outputs.digest }} - # This step uses the identity token to provision an ephemeral certificate - # against the sigstore community Fulcio instance. - run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}${DIGEST} - + + # # This will only write to the public Rekor transparency log when the Docker + # # repository is public to avoid leaking data. If you would like to publish + # # transparency data even for private images, pass --force to cosign below. + # # https://github.com/sigstore/cosign + # - name: Sign the published Docker image + # env: + # # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable + # TAGS: ${{ steps.meta.outputs.tags }} + # DIGEST: ${{ steps.build-and-push.outputs.digest }} + # # This step uses the identity token to provision an ephemeral certificate + # # against the sigstore community Fulcio instance. + # run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} + deploy: needs: build runs-on: ubuntu-latest @@ -121,7 +128,7 @@ jobs: with: task-definition: task-definition.json container-name: prod-webapp-container - image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main + image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v1