[feat] 메일 전송 api #13
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: cicd | |
on: | |
pull_request: | |
branches: [ "main" ] | |
# push: | |
# branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 🍀 JDK 17 설정 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: 🍀 application.yml 설정 | |
run: | | |
cd ./src/main | |
mkdir resources | |
cd ./resources | |
touch ./application.yml | |
echo "$APPLICATION_MAIN" > ./application.yml | |
env: | |
APPLICATION_MAIN: ${{ secrets.APPLICATION_MAIN }} | |
- name: 🍀 gradle build를 위한 권한 설정 | |
run: | | |
chmod +x gradlew | |
- name: 🍀 gradle build | |
run: | | |
./gradlew build -x test | |
- name: 🍀 docker image build 후 docker hub에 push | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t ${{ secrets.DOCKER_REPOSITORY }}/${{ secrets.DOCKER_IMAGE }} . | |
docker push ${{ secrets.DOCKER_REPOSITORY }}/${{ secrets.DOCKER_IMAGE }} | |
- name: 🍀 deploy.sh 파일을 EC2 development server로 전달 | |
uses: appleboy/scp-action@master | |
with: | |
username: ubuntu | |
host: ${{ secrets.EC2_HOST }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
port: ${{ secrets.EC2_PORT }} | |
source: "./scripts/deploy.sh" | |
target: "/home/ubuntu/" | |
- name: 🍀 docker-compose.yml 파일을 EC2 development server로 전달 | |
uses: appleboy/scp-action@master | |
with: | |
username: ubuntu | |
host: ${{ secrets.EC2_HOST }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
port: ${{ secrets.EC2_PORT }} | |
source: "./docker-compose.yml" | |
target: "/home/ubuntu/" | |
- name: 🍀 docker hub 에서 pull 후 deploy | |
uses: appleboy/ssh-action@master | |
with: | |
username: ubuntu | |
host: ${{ secrets.EC2_HOST }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
script: | | |
sudo docker pull ${{ secrets.DOCKER_REPOSITORY }}/${{ secrets.DOCKER_IMAGE }} | |
chmod 777 ./scripts/deploy.sh | |
cp ./scripts/deploy.sh ./deploy.sh | |
./deploy.sh | |
docker image prune -f |