Test: ㄹㅇ원복 (#53) #55
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 Deploy to Dev Server | |
on: | |
push: | |
branches: | |
- 'dev' | |
jobs: | |
build: | |
name: Build and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Make application.yml | |
run: | | |
mkdir -p ./src/main/resources | |
touch ./src/main/resources/application.yml | |
echo "${{ secrets.PROPERTIES_DEV }}" > ./src/main/resources/application.yml | |
shell: bash | |
- name: Make jwtsecret.properties | |
run: | | |
touch ./src/main/resources/jwtsecret.properties | |
echo "${{ secrets.JWT_PROPERTIES }}" > ./src/main/resources/jwtsecret.properties | |
shell: bash | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
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 | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: mokumoku-back | |
IMAGE_TAG: ${{ github.run_number }} | |
run: | | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
id: deploy-ec2 | |
with: | |
host: ${{ secrets.AWS_DEV_HOST }} | |
username: ${{ secrets.AWS_DEV_USERNAME }} | |
key: ${{ secrets.AWS_DEV_SSH_PRIVATE_KEY }} | |
port: ${{ secrets.AWS_PORT }} | |
script: | | |
sh deploy.sh |