From 2a684eed4da090c69518ef320380b04b1fcd684c Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Fri, 13 Mar 2026 10:20:46 +0000 Subject: [PATCH] Initial commit: hello world + deploy workflow --- .gitea/workflows/deploy.yml | 72 +++++++++++++++++++++++++++++++++++++ index.html | 20 +++++++++++ 2 files changed, 92 insertions(+) create mode 100644 .gitea/workflows/deploy.yml create mode 100644 index.html diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..6f43cef --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,72 @@ +name: Deploy to dev.bl.pixeldev.eu + +on: + push: + branches: [main] + +jobs: + deploy: + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Detect project type + id: detect + run: | + if [ -f package.json ]; then + echo "type=node" >> $GITHUB_OUTPUT + else + echo "type=static" >> $GITHUB_OUTPUT + fi + + - name: Sync files + run: | + SLUG="${{ github.event.repository.name }}" + mkdir -p /opt/deployed/${SLUG} + rsync -av --delete --exclude='.git' --exclude='node_modules' \ + $GITHUB_WORKSPACE/ /opt/deployed/${SLUG}/ + + - name: Install dependencies + if: steps.detect.outputs.type == 'node' + run: | + cd /opt/deployed/${{ github.event.repository.name }} + npm install --production + + - name: Start / restart Node service + if: steps.detect.outputs.type == 'node' + id: node + run: | + SLUG="${{ github.event.repository.name }}" + DIR="/opt/deployed/${SLUG}" + + # Find entry point + ENTRY="" + for f in server.js index.js src/server.js src/index.js; do + [ -f "$DIR/$f" ] && ENTRY="$DIR/$f" && break + done + [ -z "$ENTRY" ] && ENTRY=$(node -e "const p=require('$DIR/package.json'); console.log('$DIR/'+p.main)" 2>/dev/null) + + # Allocate port (base 4000 + hash of slug) + PORT=$((4000 + $(echo -n "$SLUG" | cksum | cut -d' ' -f1) % 1000)) + + # Start or restart + pm2 describe "deploy-${SLUG}" > /dev/null 2>&1 \ + && pm2 restart "deploy-${SLUG}" \ + || PORT=$PORT pm2 start "$ENTRY" --name "deploy-${SLUG}" + + echo "port=$PORT" >> $GITHUB_OUTPUT + + - name: Register with dev registry + run: | + SLUG="${{ github.event.repository.name }}" + NAME="${{ github.event.repository.name }}" + TYPE="${{ steps.detect.outputs.type }}" + PORT="${{ steps.node.outputs.port }}" + + curl -s -X POST https://dev.bl.pixeldev.eu/api/register \ + -H "Content-Type: application/json" \ + -u admin:blaetternd-helix-dribbble124 \ + -d "{\"name\":\"${NAME}\",\"slug\":\"${SLUG}\",\"type\":\"${TYPE}\",\"port\":\"${PORT}\"}" + + echo "✅ Live at https://dev.bl.pixeldev.eu/${SLUG}/" diff --git a/index.html b/index.html new file mode 100644 index 0000000..0292559 --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + + + + + test2 + + + +

Hello, World! 👋

+

pixeldev/test2

+ ← dev.bl.pixeldev.eu + +