generated from gc/template-java-maven
66 lines
1.9 KiB
YAML
66 lines
1.9 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: maven:3.9-eclipse-temurin-17
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git clone --depth=1 --branch=${GITHUB_REF_NAME} \
|
|
http://gitea:3000/${GITHUB_REPOSITORY}.git .
|
|
|
|
- name: Configure Maven settings
|
|
run: |
|
|
mkdir -p ~/.m2
|
|
cat > ~/.m2/settings.xml << 'SETTINGS'
|
|
<settings>
|
|
<mirrors>
|
|
<mirror>
|
|
<id>nexus</id>
|
|
<mirrorOf>*</mirrorOf>
|
|
<url>https://nexus.gc-si.dev/repository/maven-public/</url>
|
|
</mirror>
|
|
</mirrors>
|
|
<servers>
|
|
<server>
|
|
<id>nexus</id>
|
|
<username>${{ secrets.NEXUS_USERNAME }}</username>
|
|
<password>${{ secrets.NEXUS_PASSWORD }}</password>
|
|
</server>
|
|
</servers>
|
|
</settings>
|
|
SETTINGS
|
|
|
|
- name: Install Node.js
|
|
run: |
|
|
apt-get update && apt-get install -y xz-utils
|
|
curl -fsSL https://nodejs.org/dist/v20.18.1/node-v20.18.1-linux-x64.tar.xz -o node.tar.xz
|
|
tar -xJf node.tar.xz -C /usr/local --strip-components=1
|
|
rm node.tar.xz
|
|
node --version
|
|
npm --version
|
|
|
|
- name: Build Frontend
|
|
run: |
|
|
cd frontend
|
|
npm install
|
|
npm run build
|
|
cd ..
|
|
|
|
- name: Build Backend
|
|
run: mvn clean package -DskipTests -Dfrontend.skip=true -B
|
|
|
|
- name: Deploy
|
|
run: |
|
|
cp target/snp-connection-monitoring-*.jar /deploy/snp-connection/app.jar
|
|
date '+%Y-%m-%d %H:%M:%S' > /deploy/snp-connection/.deploy-trigger
|
|
echo "Deployed at $(cat /deploy/snp-connection/.deploy-trigger)"
|
|
ls -la /deploy/snp-connection/
|