Skip to content
Merged
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
28 changes: 26 additions & 2 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:
cancel-in-progress: false

jobs:
build:
build-library:
runs-on: ubuntu-22.04
steps:
- name: Checkout
Expand All @@ -36,6 +36,30 @@ jobs:
- name: Build library
run: npm run build

- name: Upload library bundle
uses: actions/upload-artifact@v4
with:
name: astrochart-bundle
path: dist/astrochart.js

build-website:
needs: build-library
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Download library bundle
uses: actions/download-artifact@v4
with:
name: astrochart-bundle
path: dist

- name: Copy bundle to website
run: cp dist/astrochart.js website/public/astrochart.js

Expand All @@ -53,7 +77,7 @@ jobs:
path: website/dist

deploy:
needs: build
needs: build-website
runs-on: ubuntu-22.04
environment:
name: github-pages
Expand Down
7 changes: 4 additions & 3 deletions website/src/components/ChartDemo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ const codeSnippet = getCodeSnippet()
chartMode: mode,
chartHeight: height,
radixData: defaultRadixData,
transitData: defaultTransitData
transitData: defaultTransitData,
baseUrl: import.meta.env.BASE_URL
}}
>
;(function () {
Expand Down Expand Up @@ -112,7 +113,7 @@ const codeSnippet = getCodeSnippet()
if (window.astrochart) {
// Library already loaded — init immediately
initChart()
} else if (document.querySelector('script[src="/astrochart.js"]')) {
} else if (document.querySelector('script[src="' + baseUrl + 'astrochart.js"]')) {
// Another instance is already loading the bundle — queue up
window.__astrochartQueue = window.__astrochartQueue || []
window.__astrochartQueue.push(initChart)
Expand All @@ -122,7 +123,7 @@ const codeSnippet = getCodeSnippet()
window.__astrochartQueue.push(initChart)

var script = document.createElement('script')
script.src = '/astrochart.js'
script.src = baseUrl + 'astrochart.js'
script.onload = function () {
var queue = window.__astrochartQueue || []
window.__astrochartQueue = []
Expand Down
Loading