Skip to content

finished week8 project #28

finished week8 project

finished week8 project #28

Workflow file for this run

name: Continuous Deployment
on:
push:
branches: [main]
jobs:
AWS_S3_Sync:
name: AWS S3 Sync
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-northeast-2
role-to-assume: arn:aws:iam::533267359186:role/GithubAction
role-session-name: S3Access
- name: Upload HTML, CSS, Javascript files to S3
run: aws s3 sync S3_files s3://tf-files-for-nginx-expressjs-project/
Update_ECR_Container:
name: Update_ECR_Container
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-northeast-2
role-to-assume: arn:aws:iam::533267359186:role/GithubAction
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
# use environemtn variables to reference registry and repository
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:expressjs"
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/skkuding_expressjs:latest
Terraform_Apply:
name: Terraform Apply
needs: [AWS_S3_Sync, Update_ECR_Container]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-northeast-2
role-to-assume: arn:aws:iam::533267359186:role/GithubAction
- name: 'Install Terraform CLI'
uses: hashicorp/setup-terraform@v3
- name: Execute 'terraform apply'
run: 'cd terraform_github_action/ && terraform init && terraform apply -auto-approve'