test #4
This file contains 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 Preview | |
on: | |
pull_request: | |
branches: | |
- main # or the branch you want to base the preview on | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
env: | |
PR_PATH: pull/${{github.event.number}} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js 22 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '22' # Specify the version of Node.js you need | |
- name: Run install and export | |
run: | | |
npm install | |
npm run export | |
- name: Comment on PR | |
uses: hasura/comment-progress@v2.2.0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.number }} | |
id: deploy-preview | |
message: "Starting deployment of preview ⏳..." | |
- name: Set base URL for preview if PR | |
run: echo "BASE_URL=https://wiki.watonomous.ca/${{ github.event.repository.name }}/${{ env.PR_PATH}}/" >> $GITHUB_ENV | |
- name: Build PR preview website | |
run: hugo --baseURL "${{ env.BASE_URL }}" | |
env: | |
HUGO_ENV: staging | |
- name: Deploy to PR preview | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./out | |
destination_dir: ${{ env.PR_PATH }} | |
cname: wiki.watonomous.ca | |
- name: Update comment | |
uses: hasura/comment-progress@v2.2.0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.number }} | |
id: deploy-preview | |
message: "A preview of ${{ github.event.after }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }} ✨\n\nChanges may take a few minutes to propagate. Since this is a preview of production, content with `draft: true` will not be rendered. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" |