ci: replace OVH FTP deploy with Cloudflare tunnel deploy via Photon
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
name: Deploy to Cloudflare (via Photon)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: deploy-production
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PUBLIC_SITE_URL: https://www.lelectronrare.fr/
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build static site
|
||||
run: npm run build
|
||||
|
||||
- name: Deploy to Photon
|
||||
uses: appleboy/scp-action@v0.1.7
|
||||
with:
|
||||
host: ${{ secrets.PHOTON_HOST }}
|
||||
username: root
|
||||
key: ${{ secrets.PHOTON_SSH_KEY }}
|
||||
source: "dist/"
|
||||
target: "/tmp/site-dist/"
|
||||
overwrite: true
|
||||
rm: true
|
||||
|
||||
- name: Restart site container
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.PHOTON_HOST }}
|
||||
username: root
|
||||
key: ${{ secrets.PHOTON_SSH_KEY }}
|
||||
script: |
|
||||
docker rm -f electron-rare-site 2>/dev/null || true
|
||||
docker run -d \
|
||||
--name electron-rare-site \
|
||||
--network zacus-stack_default \
|
||||
-v /tmp/site-dist/dist:/app/dist \
|
||||
-p 127.0.0.1:4321:4321 \
|
||||
--restart unless-stopped \
|
||||
node:22-alpine \
|
||||
sh -c 'npm install -g serve 2>/dev/null && serve /app/dist -l 4321 -s'
|
||||
|
||||
- name: Verify deployment
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.PHOTON_HOST }}
|
||||
username: root
|
||||
key: ${{ secrets.PHOTON_SSH_KEY }}
|
||||
script: |
|
||||
sleep 8
|
||||
STATUS=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:4321/)
|
||||
if [ "$STATUS" != "200" ]; then
|
||||
echo "Site returned $STATUS instead of 200"
|
||||
exit 1
|
||||
fi
|
||||
echo "Site is live (HTTP 200)"
|
||||
@@ -1,64 +0,0 @@
|
||||
name: Deploy External Site to OVH FTP
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
target:
|
||||
description: Deployment target
|
||||
required: true
|
||||
default: preview
|
||||
type: choice
|
||||
options:
|
||||
- preview
|
||||
- production
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ovh-ftp-${{ inputs.target }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
FTP_HOST: ${{ secrets.OVH_FTP_HOST }}
|
||||
FTP_USER: ${{ secrets.OVH_FTP_USER }}
|
||||
FTP_PASS: ${{ secrets.OVH_FTP_PASS }}
|
||||
FTP_PORT: ${{ secrets.OVH_FTP_PORT }}
|
||||
FTP_REMOTE_DIR: ${{ secrets.OVH_FTP_REMOTE_DIR }}
|
||||
PUBLIC_SITE_URL_PROD: ${{ vars.PUBLIC_SITE_URL_PROD }}
|
||||
PUBLIC_SITE_URL_PREVIEW: ${{ vars.PUBLIC_SITE_URL_PREVIEW }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
apps/lab-interactif/package-lock.json
|
||||
|
||||
- name: Install root dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install lab dependencies
|
||||
run: npm ci --prefix apps/lab-interactif
|
||||
|
||||
- name: Install lftp
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y lftp
|
||||
|
||||
- name: Deploy target
|
||||
env:
|
||||
DEPLOY_TARGET_SKIP_BUILD: "0"
|
||||
run: bash scripts/deploy-ovh-ftp-target.sh "${{ inputs.target }}"
|
||||
|
||||
- name: Verify public target
|
||||
run: node scripts/verify-public-target.mjs "${{ inputs.target }}"
|
||||
@@ -1,76 +0,0 @@
|
||||
name: Deploy Static Site + Lab to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
apps/lab-interactif/package-lock.json
|
||||
|
||||
- name: Install root dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install lab dependencies
|
||||
run: npm ci --prefix apps/lab-interactif
|
||||
|
||||
- name: Build lab module
|
||||
run: npm run lab:build
|
||||
|
||||
- name: Prepare pages artifact
|
||||
run: |
|
||||
mkdir -p .pages-dist
|
||||
cp index.html .pages-dist/
|
||||
cp styles.css .pages-dist/
|
||||
cp script.js .pages-dist/
|
||||
cp robots.txt .pages-dist/
|
||||
cp sitemap.xml .pages-dist/
|
||||
cp favicon.svg .pages-dist/
|
||||
cp favicon.ico .pages-dist/
|
||||
cp favicon-32x32.png .pages-dist/
|
||||
cp favicon-16x16.png .pages-dist/
|
||||
cp apple-touch-icon.png .pages-dist/
|
||||
cp -R assets .pages-dist/assets
|
||||
cp -R lab .pages-dist/lab
|
||||
if [ -f CNAME ]; then cp CNAME .pages-dist/; fi
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ./.pages-dist
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
Reference in New Issue
Block a user