Updates made to manifest and paths #100
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 PR preview | |
on: | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
pull-requests: write # Required to comment on PRs | |
jobs: | |
build-and-deploy-preview: | |
runs-on: ubuntu-latest | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
ELEVENTY_PATH_PREFIX: /preview/pr-${{ github.event.pull_request.number }}/ | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build site with Eleventy | |
run: npm run build | |
env: | |
ELEVENTY_PATH_PREFIX: /preview/pr-${{ github.event.pull_request.number }}/ | |
- name: Deploy to GitHub Pages (preview) | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
publish_branch: gh-pages | |
destination_dir: preview/pr-${{ github.event.pull_request.number }} | |
- name: Comment with Preview URL | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
✅ **Preview deployed for PR #${{ github.event.pull_request.number }} — _${{ github.event.pull_request.title }}_** | |
🔗 [View preview site](https://find-support-after-a-fit-note.digital.cabinet-office.gov.uk/preview/pr-${{ github.event.pull_request.number }}/) | |
_Note: It may take up to 30 seconds for the preview to become available due to GitHub Pages propagation._ | |