Skip to content

fix: deploy.sh 이슈 해결 테스트 #124

fix: deploy.sh 이슈 해결 테스트

fix: deploy.sh 이슈 해결 테스트 #124

Workflow file for this run

name: Build and Deploy to EC2
on:
push:
branches: [ "fix/191-deploy-sh" ]
pull_request:
branches: [ "production" ]
jobs:
build-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: make application.yml
run: |
mkdir -p ./src/main/resources
cd ./src/main/resources
touch ./application.yml
touch ./application-common.yml
touch ./application-prod.yml
echo "${{ secrets.APPLICATION }}" > ./application.yml
echo "${{ secrets.COMMON }}" > ./application-common.yml
echo "${{ secrets.PROD }}" > ./application-prod.yml
- name: make test application.yml
run: |
mkdir -p ./src/test/resources
cd ./src/test/resources
touch ./application.yml
touch ./application-test.yml
echo "${{ secrets.APPLICATION_TEST }}" > ./application.yml
echo "${{ secrets.TEST }}" > ./application-test.yml
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Build with Gradle
run: ./gradlew clean build
- name: docker login
uses: docker /login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: docker image build
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/gitget-application .
- name: dockerhub push
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/gitget-application
run-docker-image-on-ec2:
needs: build-docker-image
runs-on: self-hosted
steps:
- name: execute deploy.sh
run: sh /home/ec2-user/deploy.sh
- name: action-slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Backend
fields: repo,commit,message,author
mention: here
if_mention: failure,cancelled
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()