ffsaf-site/.gitea/workflows/deploy_in_prod.yml
Thibaut Valentin 122ac2b94f
All checks were successful
Deploy Production Server / if_merged (push) Successful in 5m3s
wip: ci/cd try file copy
2024-12-30 18:01:06 +01:00

54 lines
1.6 KiB
YAML

name: Deploy Production Server
# Only run the workflow when a PR is merged on main and closed
on: [push]
# Here we check that the PR was correctly merged to main
jobs:
if_merged:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17.0.12'
distribution: 'graalvm'
cache: 'maven'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: src/main/webapp/package-lock.json
- name: Build frontend
run: |
echo "${{ vars.VITE_ENV }}" > src/main/webapp/.env
cd src/main/webapp
npm install
npm run build
cd ../../..
- name: Inject frontend in backend
run: |
rm -rf src/main/resources/META-INF/resources
mkdir -p src/main/resources/META-INF/
mv src/main/webapp/dist src/main/resources/META-INF/resources
- name: Build backend
run: |
chmod 740 mvnw
./mvnw package -Pnative -DskipTests
- name: Copy runner to vps via scp
uses: appleboy/scp-action@v0.1.7 # Latest in date when creating the workflow
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USER }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
source: "target/*-runner,src/main/resources/cacerts"
target: ${{ secrets.TARGET_DIR }} # Need to create it first on the VPS