[feat] 1.3.1 버전 업 #107
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: ASAP-DEV-CD | |
on: | |
push: | |
branches: [ "develop" ] | |
jobs: | |
build: | |
name: Code deployment | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: make application.yml 파일 생성 | |
run: | | |
## create application.yml | |
cd ./src/main/resources | |
# application.yml 파일 생성 | |
touch ./application.yml | |
# GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기 | |
echo "${{ secrets.DOCKER_DEV_YAML }}" >> ./application.yml | |
# application.yml 파일 확인 | |
cat ./application.yml | |
shell: bash | |
- name: Build with Gradle | |
run: | | |
chmod +x gradlew | |
./gradlew build -x test | |
- name: docker build 가능하도록 환경 설정 | |
uses: docker/[email protected] | |
- name: docker hub에로그인 | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN }} | |
- name: docker image 빌드 및 푸시 | |
run: | | |
docker build --platform linux/amd64 -t ${{ secrets.DOCKERHUB_LOGIN_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }} . | |
docker tag ${{ secrets.DOCKERHUB_LOGIN_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }} ${{ secrets.DOCKERHUB_LOGIN_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:${{ secrets.DOCKERHUB_DEV_IMAGE_NAME }} | |
docker push ${{ secrets.DOCKERHUB_LOGIN_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:${{ secrets.DOCKERHUB_DEV_IMAGE_NAME }} | |
- name: 도커 컨테이너 실행 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.DEV_SERVER_IP }} | |
username: ${{ secrets.DEV_SERVER_USER }} | |
key: ${{ secrets.DEV_SERVER_KEY }} | |
script: | | |
cd ~ | |
sudo ./deploy.sh |