deployer : release #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'deployer : release' | |
permissions: | |
id-token: write | |
contents: read | |
on: | |
workflow_dispatch: | |
jobs: | |
release-image: | |
strategy: | |
matrix: | |
environment: | |
- stg | |
- prd | |
runs-on: ubuntu-latest | |
environment: ${{ matrix.environment }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.makefiles | |
deployer | |
Makefile | |
config.json | |
- uses: docker/setup-buildx-action@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-session-name: deployer-release-${{ matrix.environment }} | |
aws-region: ${{ vars.AWS_REGION }} | |
role-to-assume: ${{ vars.AWS_ROLE }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Build image | |
run: make deployer-image | |
- name: Publish image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
IMAGE_NAME: tpl-aws-astro-lambda-${{ matrix.environment }}-deployer | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
docker tag deployer ${ECR_REGISTRY}/${IMAGE_NAME}:latest | |
docker tag deployer ${ECR_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG} | |
docker push ${ECR_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG} | |
docker push ${ECR_REGISTRY}/${IMAGE_NAME}:latest |