From a55a7fd58af2e45b0149873f3483023af0d28e01 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 29 Oct 2025 01:19:27 +0100 Subject: [PATCH] Adds CI/CD pipeline for portfolio deployment 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. feat: update to use correct ssh Updates deployment script to use dist folder Modifies the deployment script to correctly reference the `dist` directory instead of the `build` directory. This ensures that the correct files are deployed to the web server. Automates deployment workflow using Gitea Actions Sets up a Gitea Actions workflow to automatically build and deploy the React portfolio website to the production server. This includes: - Using a containerized environment for consistent builds. - Installing dependencies and building the project. - Deploying the built files to the web server via SSH and rsync. - Reloading the web server configuration to apply changes. Also, this change updates the .gitignore file to exclude the 'dist' directory. edit to use ssh secret instead fix: english translation for education fix: correct contact mail fix: store system choice for theme --- .gitea/workflows/deploy.yaml | 43 ++++++++++++++++++++++++++++++++++++ .gitignore | 3 +++ src/components/App.tsx | 1 + src/components/Contact.tsx | 2 +- src/i18n/en/education.json | 10 ++++----- 5 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 .gitea/workflows/deploy.yaml diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..f00980e --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,43 @@ +name: Deploy React portfolio + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout + 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: Setup SSH + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_DEPLOY_KEY }}" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + + - name: Deploy to server + run: | + tar czf portfolio.tar.gz -C dist . + scp -i ~/.ssh/deploy_key -o StrictHostKeyChecking=accept-new portfolio.tar.gz ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/tmp/ + ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=accept-new ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "\ + sudo rm -rf ${{ secrets.DEPLOY_PATH }}/* && \ + sudo tar xzf /tmp/portfolio.tar.gz -C ${{ secrets.DEPLOY_PATH }}/ && \ + sudo rm /tmp/portfolio.tar.gz && \ + sudo chown -R deploy:www-data ${{ secrets.DEPLOY_PATH }} && \ + sudo chmod -R 775 ${{ secrets.DEPLOY_PATH }} && \ + sudo systemctl reload nginx" diff --git a/.gitignore b/.gitignore index ed0d3c8..12a47fb 100644 --- a/.gitignore +++ b/.gitignore @@ -86,3 +86,6 @@ typings/ # DynamoDB Local files .dynamodb/ + +# Vite react build output +dist/ \ No newline at end of file diff --git a/src/components/App.tsx b/src/components/App.tsx index 640adb2..b628be0 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -37,6 +37,7 @@ function App() { }; handleChange(); + localStorage.setItem('themeSelected', themeSelected); mediaQuery.addEventListener('change', handleChange); return () => mediaQuery.removeEventListener('change', handleChange); diff --git a/src/components/Contact.tsx b/src/components/Contact.tsx index 1f313d1..b80fd8f 100644 --- a/src/components/Contact.tsx +++ b/src/components/Contact.tsx @@ -12,7 +12,7 @@ const Contact = () => {

📧 {t('contact.email')} diff --git a/src/i18n/en/education.json b/src/i18n/en/education.json index b6ccae6..df94e1a 100644 --- a/src/i18n/en/education.json +++ b/src/i18n/en/education.json @@ -1,13 +1,13 @@ { "title": "Education", "degree1": { - "title": "Bachelor's Degree in Computer Science", - "school": "University Name", - "description": "Specialized in software engineering and web development" + "title": "Engineering Degree in Computer Science", + "school": "CNAM Angoulême", + "description": "Specialization in digital media science and technologies" }, "degree2": { - "title": "Technical Diploma", - "school": "Technical Institute", + "title": "Bachelor's Degree in Computer Science", + "school": "University of La Rochelle", "description": "Foundation in computer science and programming" } }