Skip to content

Commit d618846

Browse files
committed
try out artifacts
1 parent 6f19bde commit d618846

File tree

7 files changed

+60
-9
lines changed

7 files changed

+60
-9
lines changed

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
*.jl.cov
33
*.jl.mem
44
.DS_Store
5-
/Manifest.toml
5+
Manifest.toml
66
/dev/
77
/docs/build/
88
/docs/site/
99
*.js
10-
*.log
10+
*.log
11+
*.tar
12+
*.tar.gz
13+
artifacts/

Artifacts.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
[plotlylatest]
2-
git-tree-sha1 = "5821e9083cd6c4fa11bbf2f2433a411e17bffff7"
1+
[plotlyjs]
2+
git-tree-sha1 = "5067bdc8419e4cd1200c7112de5e894e4f806b58"
3+
4+
[[plotlyjs.download]]
5+
sha256 = "93092503bb83dbde5a5484fc8aaf7c10dc68ae25e777c52010a0af07c487216d"
6+
url = "https://github.com/joshday/PlotlyLight.jl/releases/download/artifacts_2022-02-11/PlotlyLightArtifacts.tar.gz"

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ authors = ["joshday <emailjoshday@gmail.com>"]
44
version = "0.4.1"
55

66
[deps]
7+
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
78
Cobweb = "ec354790-cf28-43e8-bb59-b484409b7bad"
89
DefaultApplication = "3f0dd361-4fe0-5fc6-8523-80b14ec94d85"
910
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"

deps/Project.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[deps]
2+
ArtifactUtils = "8b73e784-e7d8-4ea5-973d-377fed4e3bce"
3+
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
4+
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
5+
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
6+
PlotlyLight = "ca7969ec-10b3-423e-8d99-40f33abb42bf"
7+
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"

deps/artifact_bundle.jl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Pkg
2+
Pkg.activate(@__DIR__)
3+
4+
using Downloads, Tar, ArtifactUtils, Artifacts, Dates
5+
6+
v = "2.8.3"
7+
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+
17+
Downloads.download(url, joinpath(dir, "plotly.min.js"))
18+
19+
run(`gzip $(Tar.create(dir, tar))`)
20+
21+
#-----------------------------------------------------------------------------# upload
22+
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`)
27+
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+
"plotlyjs",
36+
"https://github.com/joshday/PlotlyLight.jl/releases/download/$artifacts_today/PlotlyLightArtifacts.tar.gz",
37+
force=true,
38+
)

deps/build.jl

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/PlotlyLight.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ using Random
44
using JSON3
55
using EasyConfig
66
using Cobweb
7+
using Artifacts
78

89
export Plot, Config
910

10-
function __init__()
11-
global plotlyjs = joinpath(@__DIR__, "..", "deps", "plotly-2.8.3.min.js")
12-
!(isfile(plotlyjs)) && @warn "Cannot find plotly.js. PlotlyLight should be built again."
13-
end
11+
plotlyjs = joinpath(artifact"plotlyjs", "plotly.min.js")
1412

1513
#-----------------------------------------------------------------------------# defaults
1614
module Defaults
1715
using EasyConfig: Config
16+
export src, class, style, parent_class, parent_style, config, layout
1817

1918
src = Ref(:cdn)
2019
class = Ref("")

0 commit comments

Comments
 (0)