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 }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
SERVER_HOST: porta-int.poweron.swiss
|
||||||
|
SERVER_USER: ubuntu
|
||||||
|
APP_DIR: /srv/nyla/current
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Setup SSH
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Set environment
|
|
||||||
run: |
|
run: |
|
||||||
|
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: Deploy
|
||||||
|
run: |
|
||||||
|
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
|
cp config/env-int.env .env
|
||||||
rm -f config/env-*.env
|
rm -f config/env-*.env
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
npm ci
|
npm ci
|
||||||
npm install express
|
npm run build:int
|
||||||
|
"
|
||||||
|
|
||||||
- name: Build React app for integration
|
- name: Health Check
|
||||||
run: npm run build:int
|
|
||||||
|
|
||||||
- name: Prepare deployment package
|
|
||||||
run: |
|
run: |
|
||||||
mkdir deploy
|
HTTP_STATUS=$(curl -sk -o /dev/null -w "%{http_code}" \
|
||||||
cp -r dist/* deploy/
|
https://${{ env.SERVER_HOST }}/ || echo "000")
|
||||||
echo "const express = require('express');" > deploy/server.js
|
if [ "$HTTP_STATUS" = "200" ]; then
|
||||||
echo "const path = require('path');" >> deploy/server.js
|
echo "Health check passed! (HTTP $HTTP_STATUS)"
|
||||||
echo "const app = express();" >> deploy/server.js
|
else
|
||||||
echo "app.use(express.static(path.join(__dirname)));" >> deploy/server.js
|
echo "Health check returned HTTP $HTTP_STATUS"
|
||||||
echo "app.get('/*', function(req, res) { res.sendFile(path.join(__dirname, 'index.html')); });" >> deploy/server.js
|
fi
|
||||||
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
|
|
||||||
|
|
|
||||||
|
|
@ -10,59 +10,44 @@ concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
SERVER_HOST: porta.poweron.swiss
|
||||||
|
SERVER_USER: ubuntu
|
||||||
|
APP_DIR: /srv/nyla/current
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Setup SSH
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Set environment
|
|
||||||
run: |
|
run: |
|
||||||
|
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: Deploy
|
||||||
|
run: |
|
||||||
|
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
|
cp config/env-prod.env .env
|
||||||
rm -f config/env-*.env
|
rm -f config/env-*.env
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
npm ci
|
npm ci
|
||||||
npm install express
|
npm run build:prod
|
||||||
|
"
|
||||||
|
|
||||||
- name: Build React app for production
|
- name: Health Check
|
||||||
run: npm run build:prod
|
|
||||||
|
|
||||||
- name: Prepare deployment package
|
|
||||||
run: |
|
run: |
|
||||||
mkdir deploy
|
HTTP_STATUS=$(curl -sk -o /dev/null -w "%{http_code}" \
|
||||||
cp -r dist/* deploy/
|
https://${{ env.SERVER_HOST }}/ || echo "000")
|
||||||
echo "const express = require('express');" > deploy/server.js
|
if [ "$HTTP_STATUS" = "200" ]; then
|
||||||
echo "const path = require('path');" >> deploy/server.js
|
echo "Health check passed! (HTTP $HTTP_STATUS)"
|
||||||
echo "const app = express();" >> deploy/server.js
|
else
|
||||||
echo "app.use(express.static(path.join(__dirname)));" >> deploy/server.js
|
echo "Health check returned HTTP $HTTP_STATUS"
|
||||||
echo "app.get('/*', function(req, res) { res.sendFile(path.join(__dirname, 'index.html')); });" >> deploy/server.js
|
fi
|
||||||
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
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
# Consumed by: Vite build (title) + SPA runtime (getApiBaseUrl / getAppName)
|
# Consumed by: Vite build (title) + SPA runtime (getApiBaseUrl / getAppName)
|
||||||
# Auth and secrets live on the gateway — never in frontend env.
|
# 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
|
VITE_APP_NAME=Poweron Nyla int
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
# Consumed by: Vite build (title) + SPA runtime (getApiBaseUrl / getAppName)
|
# Consumed by: Vite build (title) + SPA runtime (getApiBaseUrl / getAppName)
|
||||||
# Auth and secrets live on the gateway — never in frontend env.
|
# 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
|
VITE_APP_NAME=PowerOn Nyla
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue