wip: linja insa #11
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: Preview site | |
on: | |
pull_request: | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: false | |
fetch-depth: 0 | |
lfs: true | |
- name: Fetch NPM dependencies | |
env: | |
NPM_CONFIG_PREFIX: "~/.npm-global" | |
run: | | |
export PATH=$HOME/.npm-global/bin:$PATH | |
npm install -g @babel/cli @babel/core | |
yarn | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.111.3' | |
extended: true | |
- name: Setup base URL env var | |
run: | | |
export PRNUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | |
echo BASEURL="https://lipukule-site-deploy-pr-"$PRNUMBER".surge.sh/" >> $GITHUB_ENV | |
- name: Build Site | |
run: | | |
hugo --baseURL "${{ env.BASEURL }}" | |
- name: Deploy Preview | |
uses: afc163/surge-preview@v1 | |
id: preview_step | |
with: | |
surge_token: ${{ secrets.SURGE_TOKEN }} | |
github_token: ${{ secrets.GH_TOKEN }} | |
dist: public | |
failOnError: 'true' | |
teardown: true | |
build: | | |
echo Deploying to surge.sh |