Skip to content

build: add deployment previews for vega-lite documentation site #9

build: add deployment previews for vega-lite documentation site

build: add deployment previews for vega-lite documentation site #9

# .github/workflows/deployment-preview.yml
name: Deploy PR previews
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
# TODO: should this be rerun on new commits?
concurrency: preview-${{ github.ref }}
jobs:
# TODO: do we still want to run these on dependabot/non-human branches?
deploy-preview-docs:
if: github.event.action != 'closed'
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
# Copied from a section of release-docs-and-schema.yml
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: latest
- name: Install NPM dependencies
run: yarn --frozen-lockfile
- name: Prebuild website
run: yarn presite
- name: Main site build script. Might need to jekyll install
run: |
# Install bundle dependencies first
pushd site && bundle install && popd
yarn build:jekyll
# - name: Build with Jekyll
# uses: actions/jekyll-build-pages@v1
# with:
# source: site
# destination: _site
# End copy from a section of release-docs-and-schema.yml
# https://github.com/actions/upload-pages-artifact?tab=readme-ov-file#file-permissions
# - name: Fix permissions
# run: |
# chmod -c -R +r "_site/" | while read line; do
# echo "::warning title=Invalid file permissions automatically fixed::$line"
# done
- name: Deploy preview and post github comment
uses: rossjrw/pr-preview-action@v1
with:
source-dir: _site
cleanup-preview-docs:
if: github.event.action == 'closed'
runs-on: ubuntu-20.04
steps:
- name: Cleanup pr-preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: _site