Skip to content

Repl remove

Repl remove #50

Workflow file for this run

name: Build and Deploy PR Preview
# From this post:
# https://rmoff.net/2022/04/06/using-github-actions-to-build-automagic-hugo-previews-of-draft-articles/
on:
pull_request:
workflow_dispatch:
jobs:
build_preview:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.121.2
steps:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup base URL env var
run: |
export PRNUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
echo BASEURL="https://jpomfret_blog_preview-pr-"$PRNUMBER".surge.sh/" >> $GITHUB_ENV
- name: Report base URL env var
run: echo "${{ env.BASEURL }}"
- name: Build
working-directory: blog
run: hugo --baseURL "${{ env.BASEURL }}" --buildDrafts --buildFuture
- name: Deploy
uses: afc163/surge-preview@v1
id: preview_step
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: blog/public
failOnError: 'true'
teardown: true
build: |
echo Deploying to surge.sh