Skip to content

Workflow file for this run

name: Build project and publish to server
on:
push:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Build project with Maven
run: mvn clean package -DskipTests
- name: List target directory with artifacts
run: ls -la target/
- name: Copy modules to remote server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: 22
source: "target/*.jar"
target: "/deploy/artifacts/app.jar"
- name: Restart service
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: 22
script: |
docker-compose -f /deploy/docker-compose.yml restart app