upgrade gh action ver #30
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
on: | |
push: | |
release: | |
types: [published] | |
name: Docker Build and Push | |
env: | |
ECR_REGISTRY: 151345152001.dkr.ecr.ap-northeast-2.amazonaws.com | |
ECR_REPOSITORY: poapper-api | |
jobs: | |
docker_build_and_push: | |
name: Docker build and push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- 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 Amazon ECR | |
uses: aws-actions/amazon-ecr-login@v2 | |
with: | |
mask-password: 'true' | |
- name: Determine Prod/Dev Stage | |
run: | | |
if [[ ${{ github.event_name }} == 'release' ]]; then | |
echo "PROD" | |
echo "IMAGE_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | |
else | |
echo "DEV" | |
echo "IMAGE_TAG=latest" >> $GITHUB_ENV | |
fi | |
- name: Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
deploy_health_check: | |
name: Check Application Status | |
needs: docker_build_and_push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check the deployed service URL | |
uses: jtalk/url-health-check-action@v3 | |
with: | |
url: https://api.poapper.club|https://api-dev.poapper.club | |
follow-redirect: true | |
max-attempts: 3 | |
retry-delay: 10s |