|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [master, dev] |
| 5 | + pull_request: |
| 6 | + branches: [master, dev] |
| 7 | + |
| 8 | +jobs: |
| 9 | + lint: |
| 10 | + runs-on: self-hosted |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + node-version: [18] |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v3 |
| 16 | + - uses: pnpm/action-setup@v4 |
| 17 | + with: |
| 18 | + version: 9 |
| 19 | + - name: Use Node.js ${{ matrix.node-version }} |
| 20 | + uses: actions/setup-node@v3 |
| 21 | + with: |
| 22 | + node-version: ${{ matrix.node-version }} |
| 23 | + cache: 'pnpm' |
| 24 | + - run: pnpm install --frozen-lockfile |
| 25 | + - run: pnpm lint |
| 26 | + |
| 27 | + deploy-dev: |
| 28 | + if: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/dev') }} |
| 29 | + runs-on: self-hosted |
| 30 | + needs: |
| 31 | + - lint |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + - name: Install docker |
| 35 | + uses: docker/setup-buildx-action@v3 |
| 36 | + - name: Login to registry |
| 37 | + uses: docker/login-action@v3 |
| 38 | + with: |
| 39 | + registry: ${{ secrets.REGISTRY_URL }} |
| 40 | + username: ${{ secrets.REGISTRY_USERNAME }} |
| 41 | + password: ${{ secrets.REGISTRY_TOKEN }} |
| 42 | + - run: cp .env.dist .env.prod |
| 43 | + - name: Build and push |
| 44 | + uses: docker/build-push-action@v6 |
| 45 | + with: |
| 46 | + push: true |
| 47 | + build-args: | |
| 48 | + NODE_ENV=production |
| 49 | + NEXT_PUBLIC_API_URL=https://etu.dev.uttnetgroup.fr/api |
| 50 | + NEXT_PUBLIC_CAS_SERVICE_URL=https://etu.dev.uttnetgroup.fr/login |
| 51 | + NEXT_PUBLIC_API_VERSION=v1 |
| 52 | + NEXT_PUBLIC_API_REQUEST_TIMEOUT=5000 |
| 53 | + tags: | |
| 54 | + ${{ secrets.REGISTRY_URL }}/etuutt/front:dev |
| 55 | +
|
| 56 | + deploy-prod: |
| 57 | + if: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/master') }} |
| 58 | + runs-on: self-hosted |
| 59 | + needs: |
| 60 | + - lint |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v4 |
| 63 | + - name: Install docker |
| 64 | + uses: docker/setup-buildx-action@v3 |
| 65 | + - name: Login to registry |
| 66 | + uses: docker/login-action@v3 |
| 67 | + with: |
| 68 | + registry: ${{ secrets.REGISTRY_URL }} |
| 69 | + username: ${{ secrets.REGISTRY_USERNAME }} |
| 70 | + password: ${{ secrets.REGISTRY_TOKEN }} |
| 71 | + - run: cp .env.dist .env.prod |
| 72 | + - name: Build and push |
| 73 | + uses: docker/build-push-action@v6 |
| 74 | + with: |
| 75 | + push: true |
| 76 | + build-args: | |
| 77 | + NODE_ENV=production |
| 78 | + NEXT_PUBLIC_API_URL=https://etu.utt.fr/api |
| 79 | + NEXT_PUBLIC_CAS_SERVICE_URL=https://etu.utt.fr/login |
| 80 | + NEXT_PUBLIC_API_VERSION=v1 |
| 81 | + NEXT_PUBLIC_API_REQUEST_TIMEOUT=5000 |
| 82 | + tags: | |
| 83 | + ${{ secrets.REGISTRY_URL }}/etuutt/front:prod |
0 commit comments