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
66 changes: 66 additions & 0 deletions .github/workflows/BuildArtifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build Artifacts

on:
workflow_dispatch:
inputs:
js:
description: 'Javascript Resource'
required: true
type: choice
options:
- mathjax
- plotly
version:
description: 'Upstream Version Number'
required: true
type: string
buildid:
description: 'Release Build ID (+suffix)'
required: true
type: number
default: 0

permissions:
contents: write
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: julia-actions/setup-julia@v2
with:
version: "1"

- name: Build Artifacts
id: build
shell: julia --color=yes {0}
run: |
using Pkg: Artifacts
js, ver, bld, repo = "${{ inputs.js }}", "${{ inputs.version}}", ${{ inputs.buildid }}, "${{ github.repository }}"
url = Dict("mathjax" => "https://cdnjs.cloudflare.com/ajax/libs/mathjax/$ver/MathJax.js",
"plotly" => "https://cdn.plot.ly/plotly-$ver.js")[js]
h = Artifacts.create_artifact() do dir
@info "downloading $url"
download(url, joinpath(dir, "$js.js"))
end
dh = Artifacts.archive_artifact(h, joinpath("_build", "$js.tar.gz"))
release_url = "https://github.com/$repo/releases/download/$js-$ver+$bld/$js.tar.gz"
Artifacts.bind_artifact!("Artifacts.toml", js, h, force=true, download_info=[(release_url, dh)])
@info """Success: artifact"$js" bound to $release_url"""
@info """ artifact"$js" -> $h"""
@info """ $js.tar.gz -> $dh"""

- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "_build/*.tar.gz"
tag: "${{ inputs.js }}-${{ inputs.version }}+${{ inputs.buildid }}"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: "Update ${{ inputs.js }} artifact to v${{ inputs.version }}+${{ inputs.buildid }}"
body: "This is an automated pull request to update the ${{ inputs.js }} artifact corresponding to the release https://github.com/${{ github.repository }}/releases/tag/${{ inputs.js }}-${{ inputs.version }}+${{ inputs.buildid }}."
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Manifest.toml
*.png
_build
16 changes: 15 additions & 1 deletion Artifacts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,18 @@ os = "windows"

[[Kaleido_fallback.download]]
sha256 = "52bce20e749b9955ee4dd3b22fa44dbdc9a6c4a4d447e243d8c016d4b730d496"
url = "https://github.com/JuliaBinaryWrappers/Kaleido_jll.jl/releases/download/Kaleido-v0.1.0+0/Kaleido.v0.1.0.x86_64-w64-mingw32.tar.gz"
url = "https://github.com/JuliaBinaryWrappers/Kaleido_jll.jl/releases/download/Kaleido-v0.1.0+0/Kaleido.v0.1.0.x86_64-w64-mingw32.tar.gz"

[mathjax]
git-tree-sha1 = "792d2df4cd187b4dc5708917ce584ef855fffe8a"

[[mathjax.download]]
sha256 = "941755badc098140f52ca8bac64debe542f62ca444fe1708dba0bee240462c0f"
url = "https://github.com/mbauman/PlotlyKaleido.jl/releases/download/mathjax-2.7.9+0/mathjax.tar.gz"

[plotly]
git-tree-sha1 = "d0e03b7c1e3e18db75491b2175aab69b08695b5f"

[[plotly.download]]
sha256 = "cb1c0fcdffe3e7d87fe582810c22f5be3346e017a66b7f6e56b502a0040cafb2"
url = "https://github.com/mbauman/PlotlyKaleido.jl/releases/download/plotly-2.35.2+2/plotly.tar.gz"
11 changes: 7 additions & 4 deletions src/PlotlyKaleido.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,22 @@ function start(;
push!(BIN.exec, "plotly")
chromium_flags = ["--disable-gpu", Sys.isapple() ? "--single-process" : "--no-sandbox"]
extra_flags = if plotly_version === missing
(; kwargs...)
(; plotlyjs = string("file://", artifact"plotly/plotly.js"))
else
# We create a plotlyjs flag pointing at the specified plotly version
(; plotlyjs = "https://cdn.plot.ly/plotly-$(plotly_version).min.js", kwargs...)
end
if !(mathjax === missing)
if mathjax === missing
mathjaxfile = string("file://", artifact"mathjax/mathjax.js")
push!(chromium_flags, "--mathjax=$mathjaxfile")
else
if mathjax_version > _mathjax_last_version
error(
"The given mathjax version ($(mathjax_version)) is greater than the last supported version ($(_mathjax_last_version)) of Kaleido.",
)
end
if mathjax isa Bool && mathjax
push!(
if mathjax isa Bool
mathjax && push!(
chromium_flags,
"--mathjax=$(_mathjax_url_path)/$(mathjax_version)/MathJax.js",
)
Expand Down
Loading