2024-04-14 08:26:54 -07:00
|
|
|
name: Deploy API
|
2024-04-06 21:27:09 -07:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: ["master"]
|
2024-04-19 07:03:12 -07:00
|
|
|
paths: [".gitea/workflows/deploy-api.yml", "API/**", "!API/README.md"]
|
2024-04-06 21:27:09 -07:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-04-10 00:23:41 -07:00
|
|
|
java-version: ["17"]
|
|
|
|
maven-version: ["3.8.5"]
|
2024-04-14 14:29:45 -07:00
|
|
|
runs-on: "ubuntu-latest"
|
2024-04-14 08:26:54 -07:00
|
|
|
defaults:
|
|
|
|
run:
|
2024-04-14 14:29:45 -07:00
|
|
|
working-directory: "./API"
|
2024-04-06 21:27:09 -07:00
|
|
|
|
|
|
|
# Steps to run
|
|
|
|
steps:
|
|
|
|
# Checkout the repo
|
2024-04-10 00:23:41 -07:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
# Setup Java and Maven
|
|
|
|
- name: Set up JDK and Maven
|
|
|
|
uses: s4u/setup-maven-action@v1.12.0
|
|
|
|
with:
|
|
|
|
java-version: ${{ matrix.java-version }}
|
|
|
|
distribution: "zulu"
|
|
|
|
maven-version: ${{ matrix.maven-version }}
|
|
|
|
|
|
|
|
# Run JUnit Tests
|
|
|
|
- name: Run Tests
|
|
|
|
run: mvn --batch-mode test -q
|
|
|
|
|
|
|
|
# Re-checkout to reset the FS before deploying to Dokku
|
2024-04-10 01:20:39 -07:00
|
|
|
- name: Checkout - Reset FS
|
2024-04-06 21:27:09 -07:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
# Deploy to Dokku
|
|
|
|
- name: Deploy to Dokku
|
|
|
|
uses: dokku/github-action@master
|
|
|
|
with:
|
2024-04-16 16:55:40 -07:00
|
|
|
git_remote_url: "ssh://dokku@10.10.3.28:22/restfulmc-api"
|
2024-04-14 08:26:54 -07:00
|
|
|
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|