UPD - Update translations to English and add support for English loca… #38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "DEV - CI/CD" | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - develop | |
| - main | |
| jobs: | |
| # 1️⃣ Build & tests | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Generate Prisma Client | |
| run: pnpm prisma generate | |
| - name: Tests | |
| run: pnpm run test | |
| - name: Build app | |
| run: pnpm build | |
| # 2️⃣ Build & push Docker image | |
| docker-build-push: | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=dev-latest | |
| type=sha,format=long | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| NEXT_PUBLIC_ENV=develop | |
| # 3️⃣ Deploy DEV | |
| deploy-dev: | |
| runs-on: self-hosted | |
| needs: docker-build-push | |
| steps: | |
| - name: Clean workspace | |
| run: rm -rf * | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull new image + restart DEV stack | |
| run: | | |
| echo "🔧 Deploying on DEV..." | |
| cd /home/baptiste/Dev/WPT/dev | |
| docker-compose pull | |
| # stop + remove DEV containers ONLY (keeps volumes) | |
| docker-compose down | |
| # recreate containers, reusing existing volumes | |
| docker-compose up -d --remove-orphans | |
| echo "🚀 Deployed in DEV!" |