fix: rewrite workflows for Infomaniak SSH deploy, fix API URLs
All checks were successful
Deploy Nyla Frontend to Production / deploy (push) Successful in 51s
All checks were successful
Deploy Nyla Frontend to Production / deploy (push) Successful in 51s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a7921d409e
commit
7a228f0181
4 changed files with 66 additions and 96 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue