diff --git a/.gitea/workflows/check-pr.yml b/.gitea/workflows/check-pr.yml new file mode 100644 index 0000000..eab46d2 --- /dev/null +++ b/.gitea/workflows/check-pr.yml @@ -0,0 +1,47 @@ +name: Vérification PR +run-name: Vérification PR de ${{ gitea.actor }} +on: + pull_request: + branches: + - master + +jobs: + check: + 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: Vérifier les dépendances + run: yarn install --frozen-lockfile + + deploy-beta: + needs: check + 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.FRONT_DEPLOY_PATH }} + git fetch origin + git checkout ${{ gitea.head.ref }} + git pull --ff-only origin ${{ gitea.head.ref }} + corepack enable + yarn install --frozen-lockfile + yarn build + pm2 describe app-beta-pawol > /dev/null 2>&1 \ + && pm2 restart app-beta-pawol \ + || pm2 start yarn --name app-beta-pawol -- start -p ${{ secrets.DEV_PORT }} diff --git a/.gitea/workflows/deploy-beta.yml b/.gitea/workflows/deploy-beta.yml new file mode 100644 index 0000000..6a2f84b --- /dev/null +++ b/.gitea/workflows/deploy-beta.yml @@ -0,0 +1,45 @@ +name: Déploiement FRONT BETA +run-name: ${{ gitea.actor }} déploie FRONT BETA +on: + push: + branches: + - dev + +jobs: + check: + 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: Vérifier les dépendances + run: yarn install --frozen-lockfile + + deploy: + needs: check + 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.FRONT_DEPLOY_PATH }} + git pull --ff-only origin dev + corepack enable + yarn install --frozen-lockfile + yarn build + pm2 describe app-beta-pawol > /dev/null 2>&1 \ + && pm2 restart app-beta-pawol \ + || pm2 start yarn --name app-beta-pawol -- start -p ${{ secrets.DEV_PORT }} diff --git a/.gitea/workflows/deploy-prod.yml b/.gitea/workflows/deploy-prod.yml new file mode 100644 index 0000000..29297d7 --- /dev/null +++ b/.gitea/workflows/deploy-prod.yml @@ -0,0 +1,45 @@ +name: Déploiement FRONT PROD +run-name: ${{ gitea.actor }} déploie FRONT PROD +on: + push: + branches: + - master + +jobs: + check: + 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: Vérifier les dépendances + run: yarn install --frozen-lockfile + + deploy: + needs: check + 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 + yarn build + pm2 describe app-pawol > /dev/null 2>&1 \ + && pm2 restart app-pawol \ + || pm2 start yarn --name app-pawol -- start -p ${{ secrets.PROD_PORT }} diff --git a/app/robots.js b/app/robots.js index 101e6bc..57e9bdc 100644 --- a/app/robots.js +++ b/app/robots.js @@ -1,4 +1,15 @@ export default function robots() { + const isProduction = process.env.NEXT_PUBLIC_ENV === 'production'; + + if (!isProduction) { + return { + rules: { + userAgent: '*', + disallow: '/', + }, + } + } + return { rules: { userAgent: '*', diff --git a/package.json b/package.json index ce7b232..e347b3f 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,9 @@ }, "scripts": { "lint": "xo", - "dev": "next dev -p 3001", + "dev": "next dev", "build": "next build", - "start": "next start -p 3001" + "start": "next start" }, "dependencies": { "@emotion/cache": "^11.11.0",