Adds CI/CD pipeline for portfolio deployment
Some checks failed
Deploy Portfolio / deploy (push) Failing after 2m11s
Some checks failed
Deploy Portfolio / deploy (push) Failing after 2m11s
Sets up a CI/CD pipeline to automate the deployment of the portfolio website to a web server. The pipeline includes steps for: - Checking out the code - Setting up Node.js - Installing dependencies - Building the application - Deploying the built application to the web server via SSH. This automated deployment ensures that the portfolio is always up-to-date with the latest changes.
This commit is contained in:
42
.gitea/workflows/deploy.yaml
Normal file
42
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
name: Deploy Portfolio
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
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'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Deploy to web server
|
||||||
|
run: |
|
||||||
|
cd dist # ou build/ selon votre framework
|
||||||
|
tar czf ../portfolio.tar.gz *
|
||||||
|
cd ..
|
||||||
|
scp portfolio.tar.gz webserver:/tmp/
|
||||||
|
ssh webserver "cd /tmp && \
|
||||||
|
sudo rm -rf /var/www/louisemard.dev/* && \
|
||||||
|
tar xzf portfolio.tar.gz -C /var/www/louisemard.dev/ && \
|
||||||
|
rm portfolio.tar.gz && \
|
||||||
|
sudo chown -R deploy:www-data /var/www/louisemard.dev/ && \
|
||||||
|
sudo chmod -R 775 /var/www/louisemard.dev/ && \
|
||||||
|
sudo systemctl reload nginx"
|
||||||
|
|
||||||
|
- name: Deployment success
|
||||||
|
run: echo "✅ Portfolio déployé sur https://louisemard.dev"
|
||||||
Reference in New Issue
Block a user