From d7575a28bdbbbe51f0585fdaeec276e4aacfb73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sat, 16 May 2026 10:02:26 +0400 Subject: [PATCH 1/6] deploy: create workflow --- .gitea/workflows/deploy-beta.yml | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .gitea/workflows/deploy-beta.yml diff --git a/.gitea/workflows/deploy-beta.yml b/.gitea/workflows/deploy-beta.yml new file mode 100644 index 0000000..9cdacfa --- /dev/null +++ b/.gitea/workflows/deploy-beta.yml @@ -0,0 +1,41 @@ +name: Déploiement API BETA +run-name: ${{ gitea.actor }} déploie API BETA +on: + push: + branches: + - dev + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Installer les dépendances + run: yarn install --frozen-lockfile + + - name: Build Strapi + run: yarn build + + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - name: Déployer sur le serveur + uses: appleboy/ssh-action@v1 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USER }} + key: ${{ secrets.SSH_KEY }} + script: | + cd ${{ secrets.DEPLOY_PATH }} + git pull origin main + yarn install --frozen-lockfile + NODE_ENV=production yarn build + pm2 restart api-beta-pawol -- 2.30.2 From 7950eb4faea0588bac8c12ae875a31be1a07b9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sat, 16 May 2026 10:03:50 +0400 Subject: [PATCH 2/6] deploy: add yarn --- .gitea/workflows/deploy-beta.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy-beta.yml b/.gitea/workflows/deploy-beta.yml index 9cdacfa..2d5692d 100644 --- a/.gitea/workflows/deploy-beta.yml +++ b/.gitea/workflows/deploy-beta.yml @@ -15,7 +15,9 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20' - cache: 'yarn' + + - name: Activer Corepack (yarn) + run: corepack enable - name: Installer les dépendances run: yarn install --frozen-lockfile -- 2.30.2 From 4f512a555ab48ae971d47c7bed0808b55122fd2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sat, 16 May 2026 10:12:11 +0400 Subject: [PATCH 3/6] deploy: fix branch --- .gitea/workflows/deploy-beta.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy-beta.yml b/.gitea/workflows/deploy-beta.yml index 2d5692d..c09907c 100644 --- a/.gitea/workflows/deploy-beta.yml +++ b/.gitea/workflows/deploy-beta.yml @@ -36,8 +36,11 @@ jobs: username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_KEY }} script: | + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" cd ${{ secrets.DEPLOY_PATH }} - git pull origin main + git pull --ff-only origin dev + corepack enable yarn install --frozen-lockfile NODE_ENV=production yarn build pm2 restart api-beta-pawol -- 2.30.2 From 1b15741643e7ee7751fe902be8f11363ac4c4847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sat, 16 May 2026 10:48:16 +0400 Subject: [PATCH 4/6] deploy: create prod workflow --- .gitea/workflows/deploy-prod.yml | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .gitea/workflows/deploy-prod.yml diff --git a/.gitea/workflows/deploy-prod.yml b/.gitea/workflows/deploy-prod.yml new file mode 100644 index 0000000..bbcf9d1 --- /dev/null +++ b/.gitea/workflows/deploy-prod.yml @@ -0,0 +1,48 @@ +name: Déploiement API PROD +run-name: ${{ gitea.actor }} déploie API PROD +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Activer Corepack (yarn) + run: corepack enable + + - name: Installer les dépendances + run: yarn install --frozen-lockfile + + - name: Build Strapi + run: yarn build + + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - name: Déployer sur le serveur + uses: appleboy/ssh-action@v1 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USER }} + key: ${{ secrets.SSH_KEY }} + script: | + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + cd ${{ secrets.PROD_DEPLOY_PATH }} + git pull --ff-only origin master + corepack enable + yarn install --frozen-lockfile + NODE_ENV=production yarn build + pm2 describe api-pawol > /dev/null 2>&1 \ + && pm2 restart api-pawol \ + || pm2 start yarn --name api-pawol -- start -- 2.30.2 From 4fc9df88f45b617e43b3c78e641f95e639c1e3ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sat, 16 May 2026 11:17:30 +0400 Subject: [PATCH 5/6] deploy: prevent no app running in pm2 --- .gitea/workflows/deploy-beta.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy-beta.yml b/.gitea/workflows/deploy-beta.yml index c09907c..7f8d05c 100644 --- a/.gitea/workflows/deploy-beta.yml +++ b/.gitea/workflows/deploy-beta.yml @@ -43,4 +43,6 @@ jobs: corepack enable yarn install --frozen-lockfile NODE_ENV=production yarn build - pm2 restart api-beta-pawol + pm2 describe api-beta-pawol > /dev/null 2>&1 \ + && pm2 restart api-beta-pawol \ + || pm2 start yarn --name api-beta-pawol -- start -- 2.30.2 From 1d7c39973c467254c05db66187e6346e2d858f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sat, 16 May 2026 11:29:44 +0400 Subject: [PATCH 6/6] deploy: add workflow for check PR --- .gitea/workflows/check-pr.yml | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .gitea/workflows/check-pr.yml diff --git a/.gitea/workflows/check-pr.yml b/.gitea/workflows/check-pr.yml new file mode 100644 index 0000000..e7f1a44 --- /dev/null +++ b/.gitea/workflows/check-pr.yml @@ -0,0 +1,50 @@ +name: Vérification PR +run-name: Vérification PR de ${{ gitea.actor }} +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Activer Corepack (yarn) + run: corepack enable + + - name: Installer les dépendances + run: yarn install --frozen-lockfile + + - name: Build Strapi + run: yarn build + + deploy-beta: + needs: build + runs-on: ubuntu-latest + steps: + - name: Pré-déployer sur BETA pour test + uses: appleboy/ssh-action@v1 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USER }} + key: ${{ secrets.SSH_KEY }} + script: | + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + cd ${{ secrets.DEPLOY_PATH }} + git fetch origin + git checkout ${{ gitea.head.ref }} + git pull --ff-only origin ${{ gitea.head.ref }} + corepack enable + yarn install --frozen-lockfile + NODE_ENV=production yarn build + pm2 describe api-beta-pawol > /dev/null 2>&1 \ + && pm2 restart api-beta-pawol \ + || pm2 start yarn --name api-beta-pawol -- start -- 2.30.2