From 6d8955691cb6d229de8a0426f78c5ebaa91c0735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NEDJAR?= Date: Mon, 23 Mar 2026 14:21:11 +0100 Subject: [PATCH 1/2] ci: add deploy preview artifact on PRs Upload build output as artifact (7 days retention) and post a comment on the PR with a link to download and preview locally. Closes #72 --- .github/workflows/build.yml | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ed5f8e..0df63dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ on: permissions: contents: read + pull-requests: write concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} @@ -59,3 +60,42 @@ jobs: exit 1 fi echo "No broken links found" + + - name: Upload build artifact + if: github.event_name == 'pull_request' + uses: actions/upload-artifact@v4 + with: + name: site-preview + path: build/ + retention-days: 7 + + - name: Comment PR with preview link + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`; + const body = `**Preview disponible** : le site a été buildé avec succès.\n\nTéléchargez l'artifact \`site-preview\` depuis [ce run](${runUrl}) pour prévisualiser le rendu localement (\`npx serve build/\`).`; + + // Check for existing preview comment to avoid duplicates + const comments = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + const existing = comments.data.find(c => c.body.includes('Preview disponible')); + if (existing) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existing.id, + body, + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body, + }); + } From e8e0d8f83bab9761bfe3e61e22f807cc57b7379d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NEDJAR?= Date: Mon, 23 Mar 2026 14:39:15 +0100 Subject: [PATCH 2/2] ci: switch to Netlify for deploy previews Replace artifact upload + comment approach with Netlify Deploy Preview. Add netlify.toml with build config. Remove artifact/comment steps from build.yml. Netlify provides automatic deploy preview URLs on every PR with zero workflow maintenance. Closes #72 --- .github/workflows/build.yml | 40 ------------------------------------- netlify.toml | 6 ++++++ 2 files changed, 6 insertions(+), 40 deletions(-) create mode 100644 netlify.toml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0df63dd..4ed5f8e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,6 @@ on: permissions: contents: read - pull-requests: write concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} @@ -60,42 +59,3 @@ jobs: exit 1 fi echo "No broken links found" - - - name: Upload build artifact - if: github.event_name == 'pull_request' - uses: actions/upload-artifact@v4 - with: - name: site-preview - path: build/ - retention-days: 7 - - - name: Comment PR with preview link - if: github.event_name == 'pull_request' - uses: actions/github-script@v7 - with: - script: | - const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`; - const body = `**Preview disponible** : le site a été buildé avec succès.\n\nTéléchargez l'artifact \`site-preview\` depuis [ce run](${runUrl}) pour prévisualiser le rendu localement (\`npx serve build/\`).`; - - // Check for existing preview comment to avoid duplicates - const comments = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }); - const existing = comments.data.find(c => c.body.includes('Preview disponible')); - if (existing) { - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: existing.id, - body, - }); - } else { - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body, - }); - } diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..fa7975d --- /dev/null +++ b/netlify.toml @@ -0,0 +1,6 @@ +[build] + command = "npm run build" + publish = "build" + +[build.environment] + NODE_VERSION = "22"