bump node version for action #2
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: Build and Publish Docker Image | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Build Nuxt project | |
run: | | |
npm i | |
npx prisma generate | |
npm run build | |
- name: configure aws credentials | |
uses: aws-actions/[email protected] | |
with: | |
role-to-assume: arn:aws:iam::654654236858:role/GithubActions | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: us-west-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a | |
- name: Build and Push Docker image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry}} | |
IMAGE_TAG: ${{ github.sha}} | |
run: | | |
# Build a docker container and | |
# push it to ECR so that it can | |
# be deployed to ECS. | |
docker build -t $ECR_REGISTRY/ud-repo:$IMAGE_TAG . | |
docker push $ECR_REGISTRY/ud-repo:$IMAGE_TAG | |
echo "image=$ECR_REGISTRY/ud-repo:$IMAGE_TAG" >> $GITHUB_OUTPUT |