|
1 | 1 | using Pkg |
2 | 2 | Pkg.activate(@__DIR__) |
3 | 3 |
|
4 | | -using Downloads, Tar, ArtifactUtils, Artifacts, Dates |
| 4 | +using Downloads, Tar, ArtifactUtils, Artifacts, Dates, Pkg |
5 | 5 |
|
6 | | -v = "2.8.3" |
| 6 | +#-----------------------------------------------------------------------------# Start from scratch |
| 7 | +for file in readdir(@__DIR__) |
| 8 | + if endswith(file, ".tar") || endswith(file, ".gz") |
| 9 | + rm(joinpath(@__DIR__, file), force=true) |
| 10 | + end |
| 11 | +end |
| 12 | + |
| 13 | +#-----------------------------------------------------------------------------# Templates |
| 14 | +# Need to install plotly.py in order to get themes because they are generated in python |
| 15 | +# ENV["CONDA_JL_HOME"] = "/opt/homebrew/Caskroom/miniconda/base/envs/conda_jl" |
| 16 | +# Pkg.build("Conda") |
| 17 | +# using Conda |
| 18 | +# Conda.add("plotly") |
| 19 | +templates = "/opt/homebrew/Caskroom/miniconda/base/envs/conda_jl/pkgs/plotly-5.1.0-pyhd3eb1b0_0/site-packages/plotly/package_data/templates" |
| 20 | + |
| 21 | +run(`gzip $(Tar.create(templates, joinpath(@__DIR__, "templates.tar")))`) |
7 | 22 |
|
8 | | -#-----------------------------------------------------------------------------# build artifacts |
9 | | -file = "plotly-$v.min.js" |
10 | | -url = "https://cdn.plot.ly/$file" |
11 | | -dir = mkpath(joinpath(@__DIR__, "artifacts")) |
12 | | -tar = joinpath(@__DIR__, "PlotlyLightArtifacts.tar") |
13 | | -rm(tar, force=true) |
14 | | -rm(tar * ".gz", force=true) |
15 | | -artifacts_today = "artifacts_$(today())" |
16 | 23 |
|
| 24 | +#-----------------------------------------------------------------------------# Plotly.js |
| 25 | +url = "https://cdn.plot.ly/plotly-2.8.3.min.js" |
| 26 | +dir = mkpath(joinpath(@__DIR__, "plotlyjs")) |
17 | 27 | Downloads.download(url, joinpath(dir, "plotly.min.js")) |
18 | 28 |
|
19 | | -run(`gzip $(Tar.create(dir, tar))`) |
| 29 | +run(`gzip $(Tar.create(dir, joinpath(@__DIR__, "plotly.tar")))`) |
20 | 30 |
|
21 | 31 | #-----------------------------------------------------------------------------# upload |
22 | 32 | try |
23 | | - run(`gh release create $artifacts_today $tar.gz --title $artifacts_today --notes ""`) |
24 | | -catch |
25 | | - @warn "Error (probably the release already exists). Attempting to clobber artifact." |
26 | | - run(`gh release upload $artifacts_today $tar.gz --clobber`) |
| 33 | + artifacts_today = "artifacts_$(today())" |
| 34 | + |
| 35 | + run(`gh release create $artifacts_today templates.tar.gz plotly.tar.gz --title $artifacts_today --notes ""`) |
| 36 | + |
| 37 | + @info "Sleeping so artifacts are ready on GitHub..." |
| 38 | + sleep(10) |
| 39 | + add_artifact!( |
| 40 | + "Artifacts.toml", |
| 41 | + "plotly.min.js", |
| 42 | + "https://github.com/joshday/PlotlyLight.jl/releases/download/$artifacts_today/plotly.tar.gz", |
| 43 | + force=true, |
| 44 | + ) |
| 45 | + add_artifact!( |
| 46 | + "Artifacts.toml", |
| 47 | + "plotly_templates", |
| 48 | + "https://github.com/joshday/PlotlyLight.jl/releases/download/$artifacts_today/templates.tar.gz", |
| 49 | + force=true, |
| 50 | + ) |
| 51 | +catch ex |
| 52 | + @error "Error (probably the release already exists): $ex" |
27 | 53 | end |
28 | | - |
29 | | -#-----------------------------------------------------------------------------# update Artifacts.toml |
30 | | -@info "Sleeping so artifact is ready on GitHub..." |
31 | | -sleep(10) |
32 | | - |
33 | | -add_artifact!( |
34 | | - "Artifacts.toml", |
35 | | - "plotly.min.js", |
36 | | - "https://github.com/joshday/PlotlyLight.jl/releases/download/$artifacts_today/PlotlyLightArtifacts.tar.gz", |
37 | | - force=true, |
38 | | -) |
|
0 commit comments