Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/deployment-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# .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?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes


concurrency: preview-${{ github.ref }}

jobs:
# TODO: do we still want to run these on dependabot/non-human branches?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. That would be too much noise. I've never had to check dependabot PRs.

deploy-preview-docs:
if: github.event.action != 'closed'
runs-on: ubuntu-20.04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not latest?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to avoid surprise breakages by pinning to a specific version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not worried about os updates.

steps:
- name: Checkout
uses: actions/checkout@v4

# Copied from a section of release-docs-and-schema.yml
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: latest

- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Install NPM dependencies
run: yarn --frozen-lockfile

- name: Prebuild website
run: yarn presite

- name: Main site build script. Might need to bundle install
shell: bash
run: |
# Install bundle dependencies first
pushd site && bundle install && popd
# yarn build uses the wrong shell for some reason?
pushd site && bundle exec jekyll build && 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/_site
deploy-repository: vega/vega-lite-pr-previews
# TODO: ask Dom to create a token for this
token: ${{ secrets.PREVIEW_TOKEN }}

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/_site
2 changes: 2 additions & 0 deletions src/compile/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export interface CompileOptions {
* @returns An object containing the compiled Vega spec and normalized Vega-Lite spec.
*/
export function compile(inputSpec: TopLevelSpec, opt: CompileOptions = {}) {
console.log('Check if this is the preview site!', inputSpec);

// 0. Augment opt with default opts
if (opt.logger) {
// set the singleton logger to the provided logger
Expand Down
Loading