diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c99fe49..06868c0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -73,7 +73,9 @@ jobs: context: . platforms: linux/arm64 push: true - tags: 262732185023.dkr.ecr.eu-west-1.amazonaws.com/indexer:latest + tags: | + 262732185023.dkr.ecr.eu-west-1.amazonaws.com/indexer:latest + 262732185023.dkr.ecr.eu-west-1.amazonaws.com/indexer:${{ github.sha }} # Github actions cache cache-from: type=gha cache-to: type=gha,mode=max @@ -82,3 +84,5 @@ jobs: run: | echo "Deploying with stage: prod" pnpm sst deploy --stage prod + env: + COMMIT_SHA: ${{ github.sha }} diff --git a/sst.config.ts b/sst.config.ts index 340d92c..4438b4b 100644 --- a/sst.config.ts +++ b/sst.config.ts @@ -61,9 +61,12 @@ function IndexerStack({ app, stack }: StackContext) { repositoryName: "indexer", } ); + + const imageTag = process.env.COMMIT_SHA ?? "latest"; + console.log(`Will use the image ${imageTag}`); const indexerImage = ContainerImage.fromEcrRepository( containerRegistry, - "latest" + imageTag ); // The service itself