Fix :: Typo #30
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 to Amazon ECS | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
prebuild: | |
runs-on: ubuntu-latest | |
outputs: | |
hub_repository: ${{ steps.set_vars.outputs.hub_repository }} | |
image_tag: ${{ steps.set_vars.outputs.image_tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set environment variables | |
id: set_vars | |
run: | | |
echo "::set-output name=hub_repository::dyaonly/miracle" | |
echo "::set-output name=image_tag::latest" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
build: | |
needs: prebuild | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build with Gradle | |
run: ./gradlew clean build | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
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 Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: dyaonly | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build, tag, and push image to Docker Hub | |
id: build-image | |
run: | | |
docker build -t ${{ needs.prebuild.outputs.hub_repository }}:${{ needs.prebuild.outputs.image_tag }} --push . | |
- name: Fill in the new image ID in the Amazon ECS task definition | |
id: task-def | |
uses: aws-actions/amazon-ecs-render-task-definition@v1 | |
with: | |
task-definition: task-definition.json | |
container-name: mir | |
image: dyaonly/miracle | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
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: Deploy Amazon ECS task definition | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | |
with: | |
task-definition: task-definition.json | |
service: mir-service | |
cluster: miracle-cluster | |
wait-for-service-stability: true |