Skip to content

deploy

deploy #13

Workflow file for this run

name: deploy
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
environment: dev
name: build image
steps:
- name: get repo from github
uses: actions/checkout@v3
- name: setup jdk17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Gradle Ready
run: chmod +x gradlew
- name: Gradle Build
run: ./gradlew clean build -x test
- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker Image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/booklog:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/booklog:latest
deploy:
needs: build
runs-on: ubuntu-latest
environment: dev
steps:
- name: Deploy to Team Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.TEAM_SERVER_HOST }}
username: ${{ secrets.TEAM_SERVER_USERNAME }}
password: ${{ secrets.TEAM_SERVER_PASSWORD }}
port: ${{ secrets.TEAM_SERVER_PORT }}
script: |
echo "${{ secrets.TEAM_SERVER_PASSWORD }}" | sudo -S docker-compose -f /home/haneum/docker-compose.yml pull
echo "${{ secrets.TEAM_SERVER_PASSWORD }}" | sudo -S docker-compose -f /home/haneum/docker-compose.yml up -d