Skip to content

push to ecr: production #12

push to ecr: production

push to ecr: production #12

Workflow file for this run

name: "push to ecr: production"
on:
workflow_dispatch:
env:
ECR_REPOSITORY: "thumbnail-api"
jobs:
ecr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf
with:
image: tonistiigi/binfmt:latest
platforms: arm64,arm
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: npm ci
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076
- name: Upload sourcemap to Sentry
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
npm ci
npm install tsc -g
npm run build
npm run sentry:sourcemaps
shell: bash
# Get branch names for ECR tagging
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
# Push to ECR
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
IMAGE_TAG: ${{ github.sha }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker buildx build \
-t $ECR_REGISTRY/$ECR_REPOSITORY:latest \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$BRANCH_NAME \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
--platform linux/amd64,linux/arm64 . \
--sbom=true \
--provenance=true \
--push