feat: configure CI/CD with Forgejo Actions
Some checks failed
Deploy / Build and Deploy to Production (push) Failing after 26s
Some checks failed
Deploy / Build and Deploy to Production (push) Failing after 26s
- Add Forgejo workflow for automated build and deploy - Build creates dist/ from public/ then adds Vue app build - Configure Vite to build to dist/assets/dist with fixed filenames - Deploy entire dist/ directory to production via FTP - Add workflow documentation with FTP setup instructions The workflow mirrors the GitLab CI approach: dist/ is created during build and synchronized to production root on every push to main. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5fb9cf68a3
commit
052c6958f3
3 changed files with 127 additions and 0 deletions
43
.forgejo/workflows/README.md
Normal file
43
.forgejo/workflows/README.md
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# CI/CD avec Forgejo
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
Le workflow `deploy.yml` automatise le build de l'application Vue et le déploiement sur le serveur de production.
|
||||
|
||||
## Workflow
|
||||
|
||||
À chaque push sur la branche `main` :
|
||||
|
||||
1. **Checkout** : Clone le dépôt
|
||||
2. **Setup Node.js** : Installe Node.js 20
|
||||
3. **Install dependencies** : Installe les dépendances npm
|
||||
4. **Build Vue app** : Compile l'application Vue vers `public/assets/dist/`
|
||||
5. **Deploy via FTP** : Synchronise les fichiers vers le serveur de production
|
||||
|
||||
## Configuration des secrets
|
||||
|
||||
Dans Forgejo, configurez les secrets suivants (Settings > Secrets and Variables > Actions) :
|
||||
|
||||
- `USERNAME` : Nom d'utilisateur FTP
|
||||
- `PASSWORD` : Mot de passe FTP
|
||||
- `PRODUCTION_HOST` : Hôte FTP (format : `ftp://host.example.com`)
|
||||
|
||||
## Fichiers déployés
|
||||
|
||||
Le workflow déploie depuis le dossier `public/` :
|
||||
|
||||
- `public/assets/` → `assets/` (incluant le build Vue dans `assets/dist/`)
|
||||
- `public/site/` → `site/` (excluant accounts/, cache/, sessions/)
|
||||
- `public/kirby/` → `kirby/`
|
||||
- `public/vendor/` → `vendor/`
|
||||
- `public/index.php` → `index.php`
|
||||
|
||||
## Build local
|
||||
|
||||
Pour tester le build localement :
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
Les fichiers seront générés dans `public/assets/dist/` (ignorés par git).
|
||||
65
.forgejo/workflows/deploy.yml
Normal file
65
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Build and Deploy to Production
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: Checkout code
|
||||
run: |
|
||||
git clone --depth 1 --branch main https://forge.studio-variable.com/${{ github.repository }}.git .
|
||||
ls -la
|
||||
|
||||
- name: Setup Node.js
|
||||
run: |
|
||||
apt-get update -qq && apt-get install -y -qq curl
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
||||
apt-get install -y -qq nodejs
|
||||
node --version
|
||||
npm --version
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci
|
||||
|
||||
- name: Prepare dist directory
|
||||
run: |
|
||||
rm -rf dist
|
||||
cp -r public dist
|
||||
ls -la dist/
|
||||
|
||||
- name: Build Vue app
|
||||
run: |
|
||||
npm run build
|
||||
ls -la dist/assets/dist/
|
||||
|
||||
- name: Deploy via FTP
|
||||
env:
|
||||
USERNAME: ${{ secrets.USERNAME }}
|
||||
PASSWORD: ${{ secrets.PASSWORD }}
|
||||
PRODUCTION_HOST: ${{ secrets.PRODUCTION_HOST }}
|
||||
run: |
|
||||
apt-get install -y -qq lftp
|
||||
cd dist
|
||||
lftp -c "
|
||||
set ftp:ssl-allow no;
|
||||
open -u $USERNAME,$PASSWORD $PRODUCTION_HOST;
|
||||
mirror --reverse --verbose --ignore-time --parallel=10 \
|
||||
-x 'local/' \
|
||||
assets assets;
|
||||
mirror --reverse --verbose --ignore-time --parallel=10 \
|
||||
-x 'accounts/' \
|
||||
-x 'cache/' \
|
||||
-x 'sessions/' \
|
||||
site site;
|
||||
mirror --reverse --verbose --ignore-time --parallel=10 \
|
||||
kirby kirby;
|
||||
mirror --reverse --verbose --ignore-time --parallel=10 \
|
||||
vendor vendor;
|
||||
put index.php -o index.php;
|
||||
quit"
|
||||
Loading…
Add table
Add a link
Reference in a new issue