Merge pull request #292 from MOONSHOT-Team/feature/#291 #31
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: dev-CD | |
on: | |
push: | |
branches: [ "develop" ] | |
jobs: | |
dev-ci: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- name: application.yml 생성 및 data.sql 생성 | |
run: | | |
cd moonshot-api/src/main/resources | |
echo "${{ secrets.DEV_APPLICATION }}" > ./application-dev.yml | |
echo "${{ secrets.DATA }}" > ./data.sql | |
- name: build | |
run: | | |
chmod +x gradlew | |
./gradlew moonshot-api:build -x test | |
shell: bash | |
- name: docker build setting | |
uses: docker/[email protected] | |
- name: docker hub login | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN }} | |
- name: docker image build and push | |
run: | | |
docker build -f Dockerfile-dev --platform linux/amd64 -t teammoonshot/dev-server . | |
docker push teammoonshot/dev-server | |
dev-cd: | |
needs: dev-ci | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: docker container running | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.DEV_SERVER_IP }} | |
username: ${{ secrets.DEV_SERVER_USER }} | |
key: ${{ secrets.DEV_SERVER_KEY }} | |
script: | | |
cd ~ | |
./deploy.sh |