Merge pull request #20 from Billing-Wise/dev #4
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: CD | |
on: | |
push: | |
branches: | |
- prod | |
jobs: | |
deploy: | |
name: Deploy to AWS | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: create secure file | |
run: | | |
cd src/main/resources | |
touch secure.properties | |
echo "${{ secrets.SECURE }}" >> secure.properties | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Login to Amazon ECR | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: gradle | |
- name: Grant execute permission to Gradle Wrapper | |
run: chmod +x ./gradlew | |
- name: Build and push image to Amazon ECR | |
run: ./gradlew clean jib -x test | |
- name: Deploy to AWS ECS | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | |
with: | |
task-definition: task-definition.json | |
cluster: t5-ecs-fargate-cluster | |
service: t5-batch-service | |
wait-for-service-stability: true |