style: 환경변수 네이밍 underline -> dash #2
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: CD | |
on: | |
push: | |
branches: [ "master" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set jdk 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set yml file | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: src/main/resources/application.yml | |
env: | |
jwt.access-secret: ${{ secrets.JWT_ACCESS_KEY }} | |
jwt.refresh-secret: ${{ secrets.JWT_REFRESH_KEY }} | |
jwt.access-expiry-date: ${{ secrets.JWT_ACCESS_EXPIRY_DATE }} | |
jwt.refresh-expiry-date: ${{ secrets.JWT_REFRESH_EXPIRY_DATE }} | |
- name: Build with gradle | |
run: ./gradlew build | |
- name: Build docker image | |
run: | | |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }} | |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/token-server:latest . | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/token-server:latest | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run docker image | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.LINUX_HOST }} | |
username: ${{ secrets.LINUX_USERNAME }} | |
password: ${{ secrets.LINUX_PASSWORD }} | |
port: ${{ secrets.LINUX_SSH_PORT }} | |
script: | | |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }} | |
docker stop token-server | |
docker rm token-server | |
docker rmi ${{ secrets.DOCKERHUB_USERNAME }}/token-server:latest | |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/token-server:latest | |
docker run -d -p 8050:8050 --name token-server ${{ secrets.DOCKERHUB_USERNAME }}/token-server:latest |