Version updated from 0.3.0 to 0.4.0 #22
Workflow file for this run
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: Deploy Release to ECR | |
on: | |
# release: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: # Allow manual invocation of the workflow | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Get the tag version | |
id: get_version | |
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//} | |
#---------------------------------------------- | |
# build Frontend files | |
#---------------------------------------------- | |
- name: Build frontend | |
run: | | |
npm ci | |
npm run tailwind-build | |
npm run webpack-build | |
if [ -f frontend/static/src/output.css ]; then | |
echo "output.css is created" | |
else | |
echo "output.css is not created" | |
exit 1 | |
fi | |
if [ -f frontend/static/js/bundle.js ] && [ -f frontend/static/js/bundle.js.map ]; then | |
echo "bundle.js and bundle.js.map are created" | |
else | |
echo "bundle.js and/or bundle.js.map are not created" | |
exit 1 | |
fi | |
- name: Configure AWS credentials | |
id: aws-credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
# role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | |
aws-region: "us-east-1" | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
with: | |
registry-type: public | |
- name: Build, tag, and push image to Amazon ECR | |
id: build-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }} | |
IMAGE_TAG: ${{ steps.get_version.outputs.TAG_NAME }} #${{ github.sha }} | |
run: | | |
cp infrastructure/backend/Dockerfile ./Dockerfile | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest | |
echo "::set-output name=latest_image::$ECR_REGISTRY/$ECR_REPOSITORY:latest" |