Skip to content

feat(workflows/deploy): update server #6

feat(workflows/deploy): update server

feat(workflows/deploy): update server #6

Workflow file for this run

name: Deploy
on:
push:
branches:
- master
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu' # Alternative distribution options are available
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
- name: Build project
run: ./gradlew bootWar
- name: Build image
run: docker compose build
- name: Push image
run: docker compose push
- name: Update server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_SSH_HOST }}
port: ${{ secrets.SERVER_SSH_PORT }}
username: ${{ secrets.SERVER_SSH_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: docker compose pull && docker compose up -d