Pages déclarants #52
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: Deploy (testing) to Scaleway | |
| on: | |
| push: | |
| branches: ["testing"] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: deploy-testing | |
| cancel-in-progress: true | |
| jobs: | |
| test_build_deploy: | |
| runs-on: ubuntu-latest | |
| environment: testing | |
| env: | |
| TZ: Europe/Paris | |
| SCW_REGION: ${{ vars.SCW_REGION }} | |
| SCW_REGISTRY_ENDPOINT: ${{ vars.SCW_REGISTRY_ENDPOINT }} | |
| SCW_IMAGE_NAME: ${{ vars.SCW_IMAGE_NAME }} | |
| SCW_SERVERLESS_CONTAINER_ID: ${{ secrets.SCW_SERVERLESS_CONTAINER_ID_TESTING }} | |
| NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Enable corepack | |
| run: corepack enable | |
| - name: Use Node.js 22.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "yarn" | |
| - name: Install deps | |
| run: yarn --immutable | |
| - name: Lint | |
| run: yarn lint | |
| - name: Test | |
| run: yarn test | |
| - name: Build (Next.js) | |
| run: yarn build | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Scaleway Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.SCW_REGISTRY_ENDPOINT }} | |
| username: nologin | |
| password: ${{ secrets.SCW_SECRET_KEY }} | |
| - name: Build & push image (testing-latest + sha) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./deploy/Dockerfile | |
| platforms: linux/amd64 | |
| push: true | |
| tags: | | |
| ${{ env.SCW_REGISTRY_ENDPOINT }}/${{ env.SCW_IMAGE_NAME }}:testing-latest | |
| ${{ env.SCW_REGISTRY_ENDPOINT }}/${{ env.SCW_IMAGE_NAME }}:testing-${{ github.sha }} | |
| build-args: | | |
| NEXT_PUBLIC_API_URL=${{ env.NEXT_PUBLIC_API_URL }} | |
| - name: Install Scaleway CLI | |
| run: | | |
| curl -fsSL https://raw.githubusercontent.com/scaleway/scaleway-cli/master/scripts/get.sh | sh | |
| scw version | |
| - name: Deploy to Scaleway Serverless Container (testing) | |
| env: | |
| SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }} | |
| SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }} | |
| SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }} | |
| SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }} | |
| SCW_DEFAULT_REGION: ${{ env.SCW_REGION }} | |
| SCW_SERVERLESS_CONTAINER_ID_TESTING: ${{ secrets.SCW_SERVERLESS_CONTAINER_ID_TESTING }} | |
| SCW_REGISTRY_ENDPOINT: ${{ env.SCW_REGISTRY_ENDPOINT }} | |
| SCW_IMAGE_NAME: ${{ env.SCW_IMAGE_NAME }} | |
| run: | | |
| scw container container update "$SCW_SERVERLESS_CONTAINER_ID_TESTING" \ | |
| registry-image="$SCW_REGISTRY_ENDPOINT/$SCW_IMAGE_NAME:testing-latest" |