Skip to content

Commit

Permalink
Add build previews (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
goodroot authored Nov 21, 2024
1 parent 6ccaeb1 commit f1457fd
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Preview trigger

on:
pull_request:
types: ["opened", "edited", "synchronize"]

jobs:
pr-preview:
name: "PR preview"
runs-on: ubuntu-latest

steps:
- name: Checkout questdb.io repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'

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

- name: Build site
env:
CONTEXT: deploy-preview
NETLIFY: true
run: yarn build

- name: Deploy to Netlify
uses: jsmrcaga/[email protected]
with:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
build_directory: build
install_command: "echo Skipping installing the dependencies"
build_command: "echo Skipping building the web files"
deploy_alias: preview-${{ github.event.pull_request.number }}

- name: "Update PR"
if: ${{ env.NETLIFY_PREVIEW_URL }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
:rocket: **Build success!**
Latest successful preview: ${{ env.NETLIFY_PREVIEW_URL }}
Commit SHA: ${{ github.event.pull_request.head.sha }}
> :package: Build generates a preview & updates link on each commit.
comment_tag: execution
3 changes: 2 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import dotenv from "dotenv"
const ssrTemplate = require("./src/internals/ssr.template")
const customFields = require("./src/config/customFields")
const path = require("path")
const isPreviews = process.env.NETLIFY && process.env.CONTEXT === 'deploy-preview'

dotenv.config()

const config = {
title: "QuestDB",
tagline: "QuestDB is the fastest open source time series database",
url: `https://${customFields.domain}`,
baseUrl: "/docs/",
baseUrl: isPreviews ? '/' : '/docs/',
baseUrlIssueBanner: false,
favicon: "/images/favicon.webp",
organizationName: "QuestDB",
Expand Down

0 comments on commit f1457fd

Please sign in to comment.