Transition to Gitea workflows
This commit is contained in:
59
os-league-tools-master/.gitea/workflows/build-deploy.yml
Normal file
59
os-league-tools-master/.gitea/workflows/build-deploy.yml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
name: Build & Deploy OS League Tools
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ["cicd"]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build production bundle
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: frontend-build
|
||||||
|
path: build/
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
runs-on: [frontend]
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: frontend-build
|
||||||
|
path: /home/sonder/deploy/os-league-tools-build
|
||||||
|
|
||||||
|
- name: List deploy directory
|
||||||
|
run: ls -al /home/sonder/deploy/os-league-tools-build
|
||||||
|
|
||||||
|
- name: Stop service
|
||||||
|
run: sudo systemctl stop os-league-tools || true
|
||||||
|
|
||||||
|
- name: Deploy new build
|
||||||
|
run: |
|
||||||
|
sudo rm -rf /home/sonder/leagues-tools/os-league-tools-master/build
|
||||||
|
sudo cp -r /home/sonder/deploy/os-league-tools-build /home/sonder/leagues-tools/os-league-tools-master/build
|
||||||
|
sudo chown -R sonder:sonder /home/sonder/leagues-tools/os-league-tools-master/build
|
||||||
|
|
||||||
|
- name: Start service
|
||||||
|
run: sudo systemctl start os-league-tools
|
||||||
|
|
||||||
|
- name: Cleanup deploy artifacts
|
||||||
|
run: rm -rf /home/sonder/deploy/os-league-tools-build
|
||||||
35
os-league-tools.service
Normal file
35
os-league-tools.service
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=OS League Tools - OSRS Leagues Hub
|
||||||
|
After=network.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=sonder
|
||||||
|
Group=sonder
|
||||||
|
WorkingDirectory=/home/sonder/leagues-tools/os-league-tools-master
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
Environment="NODE_ENV=production"
|
||||||
|
Environment="PORT=3000"
|
||||||
|
# Uncomment and set if you have a backend API:
|
||||||
|
# Environment="REACT_APP_RELDO_URL=http://localhost:8080"
|
||||||
|
|
||||||
|
# Start the application (serves the pre-built static files)
|
||||||
|
ExecStart=/usr/bin/npm start
|
||||||
|
|
||||||
|
# Restart policy
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=10s
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
StandardOutput=journal
|
||||||
|
StandardError=journal
|
||||||
|
SyslogIdentifier=os-league-tools
|
||||||
|
|
||||||
|
# Security hardening
|
||||||
|
NoNewPrivileges=true
|
||||||
|
PrivateTmp=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user