From 7a228f018139902a242f4f33d37cc1709cb2f92f Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Sun, 24 May 2026 03:03:47 +0200
Subject: [PATCH] fix: rewrite workflows for Infomaniak SSH deploy, fix API
URLs
Co-authored-by: Cursor
---
.forgejo/workflows/int_porta-int-ui-nyla.yml | 79 ++++++++-----------
.../workflows/main_porta-main-ui-nyla.yml | 79 ++++++++-----------
config/env-int.env | 2 +-
config/env-prod.env | 2 +-
4 files changed, 66 insertions(+), 96 deletions(-)
diff --git a/.forgejo/workflows/int_porta-int-ui-nyla.yml b/.forgejo/workflows/int_porta-int-ui-nyla.yml
index 053ab2d..abb981b 100644
--- a/.forgejo/workflows/int_porta-int-ui-nyla.yml
+++ b/.forgejo/workflows/int_porta-int-ui-nyla.yml
@@ -10,59 +10,44 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
+env:
+ SERVER_HOST: porta-int.poweron.swiss
+ SERVER_USER: ubuntu
+ APP_DIR: /srv/nyla/current
+
jobs:
- build-and-deploy:
+ deploy:
runs-on: ubuntu-latest
steps:
- - name: Checkout Code
- uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
-
- - name: Set environment
+ - name: Setup SSH
run: |
- cp config/env-int.env .env
- rm -f config/env-*.env
+ mkdir -p ~/.ssh
+ echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
+ chmod 600 ~/.ssh/deploy_key
+ echo "StrictHostKeyChecking=no" >> ~/.ssh/config
+ echo "UserKnownHostsFile=/dev/null" >> ~/.ssh/config
- - name: Install dependencies
+ - name: Deploy
run: |
- npm ci
- npm install express
+ ssh -i ~/.ssh/deploy_key ${{ env.SERVER_USER }}@${{ env.SERVER_HOST }} "
+ set -e
+ cd ${{ env.APP_DIR }}
+ git remote set-url origin ssh://git@git.poweron.swiss:2222/PowerOn/ui-nyla.git
+ git fetch origin int
+ git reset --hard origin/int
+ cp config/env-int.env .env
+ rm -f config/env-*.env
+ npm ci
+ npm run build:int
+ "
- - name: Build React app for integration
- run: npm run build:int
-
- - name: Prepare deployment package
+ - name: Health Check
run: |
- mkdir deploy
- cp -r dist/* deploy/
- echo "const express = require('express');" > deploy/server.js
- echo "const path = require('path');" >> deploy/server.js
- echo "const app = express();" >> deploy/server.js
- echo "app.use(express.static(path.join(__dirname)));" >> deploy/server.js
- echo "app.get('/*', function(req, res) { res.sendFile(path.join(__dirname, 'index.html')); });" >> deploy/server.js
- echo "const port = process.env.PORT || 8080;" >> deploy/server.js
- echo "app.listen(port, () => console.log('Server running on port', port));" >> deploy/server.js
- echo '{
- "name": "frontend-int",
- "version": "1.0.0",
- "private": true,
- "scripts": {
- "start": "node server.js"
- },
- "dependencies": {
- "express": "^4.18.2"
- }
- }' > deploy/package.json
-
- - name: 'Deploy to Azure Web App'
- uses: https://github.com/Azure/webapps-deploy@v3
- with:
- app-name: 'poweron-nyla-int'
- publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_POWERON_NYLA_INT }}
- package: ./deploy
+ HTTP_STATUS=$(curl -sk -o /dev/null -w "%{http_code}" \
+ https://${{ env.SERVER_HOST }}/ || echo "000")
+ if [ "$HTTP_STATUS" = "200" ]; then
+ echo "Health check passed! (HTTP $HTTP_STATUS)"
+ else
+ echo "Health check returned HTTP $HTTP_STATUS"
+ fi
diff --git a/.forgejo/workflows/main_porta-main-ui-nyla.yml b/.forgejo/workflows/main_porta-main-ui-nyla.yml
index 3ae5cfd..264c746 100644
--- a/.forgejo/workflows/main_porta-main-ui-nyla.yml
+++ b/.forgejo/workflows/main_porta-main-ui-nyla.yml
@@ -10,59 +10,44 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
+env:
+ SERVER_HOST: porta.poweron.swiss
+ SERVER_USER: ubuntu
+ APP_DIR: /srv/nyla/current
+
jobs:
- build-and-deploy:
+ deploy:
runs-on: ubuntu-latest
steps:
- - name: Checkout Code
- uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
-
- - name: Set environment
+ - name: Setup SSH
run: |
- cp config/env-prod.env .env
- rm -f config/env-*.env
+ mkdir -p ~/.ssh
+ echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
+ chmod 600 ~/.ssh/deploy_key
+ echo "StrictHostKeyChecking=no" >> ~/.ssh/config
+ echo "UserKnownHostsFile=/dev/null" >> ~/.ssh/config
- - name: Install dependencies
+ - name: Deploy
run: |
- npm ci
- npm install express
+ ssh -i ~/.ssh/deploy_key ${{ env.SERVER_USER }}@${{ env.SERVER_HOST }} "
+ set -e
+ cd ${{ env.APP_DIR }}
+ git remote set-url origin ssh://git@git.poweron.swiss:2222/PowerOn/ui-nyla.git
+ git fetch origin main
+ git reset --hard origin/main
+ cp config/env-prod.env .env
+ rm -f config/env-*.env
+ npm ci
+ npm run build:prod
+ "
- - name: Build React app for production
- run: npm run build:prod
-
- - name: Prepare deployment package
+ - name: Health Check
run: |
- mkdir deploy
- cp -r dist/* deploy/
- echo "const express = require('express');" > deploy/server.js
- echo "const path = require('path');" >> deploy/server.js
- echo "const app = express();" >> deploy/server.js
- echo "app.use(express.static(path.join(__dirname)));" >> deploy/server.js
- echo "app.get('/*', function(req, res) { res.sendFile(path.join(__dirname, 'index.html')); });" >> deploy/server.js
- echo "const port = process.env.PORT || 8080;" >> deploy/server.js
- echo "app.listen(port, () => console.log('Server running on port', port));" >> deploy/server.js
- echo '{
- "name": "frontend",
- "version": "1.0.0",
- "private": true,
- "scripts": {
- "start": "node server.js"
- },
- "dependencies": {
- "express": "^4.18.2"
- }
- }' > deploy/package.json
-
- - name: 'Deploy to Azure Web App'
- uses: https://github.com/Azure/webapps-deploy@v3
- with:
- app-name: 'poweron-nyla'
- publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_POWERON_NYLA }}
- package: ./deploy
+ HTTP_STATUS=$(curl -sk -o /dev/null -w "%{http_code}" \
+ https://${{ env.SERVER_HOST }}/ || echo "000")
+ if [ "$HTTP_STATUS" = "200" ]; then
+ echo "Health check passed! (HTTP $HTTP_STATUS)"
+ else
+ echo "Health check returned HTTP $HTTP_STATUS"
+ fi
diff --git a/config/env-int.env b/config/env-int.env
index 6655d68..2fea0f9 100644
--- a/config/env-int.env
+++ b/config/env-int.env
@@ -2,5 +2,5 @@
# Consumed by: Vite build (title) + SPA runtime (getApiBaseUrl / getAppName)
# Auth and secrets live on the gateway — never in frontend env.
-VITE_API_BASE_URL=https://gateway-int.poweron.swiss
+VITE_API_BASE_URL=https://api-int.poweron.swiss
VITE_APP_NAME=Poweron Nyla int
diff --git a/config/env-prod.env b/config/env-prod.env
index 7c3adff..cd0ec40 100644
--- a/config/env-prod.env
+++ b/config/env-prod.env
@@ -2,5 +2,5 @@
# Consumed by: Vite build (title) + SPA runtime (getApiBaseUrl / getAppName)
# Auth and secrets live on the gateway — never in frontend env.
-VITE_API_BASE_URL=https://gateway-prod.poweron.swiss
+VITE_API_BASE_URL=https://api.poweron.swiss
VITE_APP_NAME=PowerOn Nyla