Updated CI workflow
Moorly Website CI / build (push) Successful in 6s

This commit is contained in:
Squid committed 2026-11-05 21:08:54 +01:00
1 parent 2284236ef5
commit 1327350c66
1 file changed
+19 -4
+19 -4
View File
@@ -5,8 +5,9 @@ on:
push:
branches:
- dev
- main
workflow_dispatch:
jobs:
build:
runs-on: linux-x64
@@ -33,8 +34,9 @@ jobs:
- name: Security audit
run: npm audit
- name: Deploy dev
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
- name: Deploy website
if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main')
env:
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
@@ -42,6 +44,19 @@ jobs:
run: |
set -eu
case "$GITHUB_REF" in
refs/heads/dev)
DEPLOY_PATH="/var/MoorlyWeb/dev/"
;;
refs/heads/main)
DEPLOY_PATH="/var/MoorlyWeb/production/"
;;
*)
echo "Unsupported branch: $GITHUB_REF"
exit 1
;;
esac
KEY_FILE="$(mktemp)"
trap 'rm -f "$KEY_FILE"' EXIT
@@ -50,5 +65,5 @@ jobs:
rsync -az --delete \
-e "ssh -i $KEY_FILE -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts" \
dist/ "${DEPLOY_USER}@${DEPLOY_HOST}:/var/MoorlyWeb/dev/"
dist/ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"