Skip to content

Commit e61d569

Browse files
authored
Merge pull request #10 from EarthyScience/la/text
2 parents 67fe260 + aa5e278 commit e61d569

File tree

13 files changed

+241
-3
lines changed

13 files changed

+241
-3
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Doc Preview Cleanup
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
workflow_dispatch:
8+
schedule:
9+
- cron: "0 0 * * *"
10+
11+
jobs:
12+
doc-preview-cleanup:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout gh-pages branch
16+
uses: actions/checkout@v4
17+
with:
18+
ref: gh-pages
19+
- uses: julia-actions/setup-julia@v2
20+
with:
21+
version: '1'
22+
- name: Check for stale PR previews
23+
shell: julia {0}
24+
run: |
25+
using Pkg
26+
pkg"activate --temp"
27+
pkg"add HTTP JSON3"
28+
29+
using HTTP
30+
using JSON3
31+
using Dates
32+
33+
repo = ENV["GITHUB_REPOSITORY"]
34+
retention_days = 14
35+
36+
pr_previews = map(filter(startswith("PR"), readdir("previews"))) do dir
37+
parse(Int, match(r"PR(\d*)", dir)[1])
38+
end
39+
40+
function all_prs()
41+
query_prs(page) = JSON3.read(HTTP.get("https://api.github.com/repos/$repo/pulls?per_page=100;page=$(page)").body)
42+
prs = []
43+
page = 1
44+
while true
45+
page_prs = query_prs(page)
46+
isempty(page_prs) && break
47+
append!(prs, page_prs)
48+
page += 1
49+
end
50+
return prs
51+
end
52+
prs = all_prs()
53+
open_within_threshold = map(x -> x.number, filter(prs) do pr
54+
time = DateTime(pr.updated_at[1:19], ISODateTimeFormat)
55+
return pr.state == "open" && Dates.days(now() - time) <= retention_days
56+
end)
57+
58+
stale_previews = setdiff(pr_previews, open_within_threshold)
59+
@info "Found $(length(stale_previews)) stale previews"
60+
61+
if isempty(stale_previews)
62+
@info "No stale previews"
63+
exit(1)
64+
end
65+
66+
for pr in stale_previews
67+
path = joinpath("previews", "PR$pr")
68+
@info "Removing $path"
69+
run(`git rm -rf $path`)
70+
end
71+
- name: Push changes
72+
run: |
73+
git config user.name "Documenter.jl"
74+
git config user.email "documenter@juliadocs.github.io"
75+
git commit -m "delete preview"
76+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
77+
git push --force origin gh-pages-new:gh-pages

.github/workflows/Documenter.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Sample workflow for building and deploying a VitePress site to GitHub Pages
2+
#
3+
name: Documenter
4+
5+
on:
6+
# Runs on pushes targeting the `master` branch. Change this to `main` if you're
7+
# using the `main` branch as the default branch.
8+
push:
9+
branches:
10+
- master
11+
tags: ['*']
12+
pull_request:
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
18+
permissions:
19+
contents: write
20+
pages: write
21+
id-token: write
22+
statuses: write
23+
24+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
25+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
26+
concurrency:
27+
group: pages
28+
cancel-in-progress: false
29+
30+
jobs:
31+
# Build job
32+
build:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
- name: Setup Julia
38+
uses: julia-actions/setup-julia@v1
39+
- name: Load Julia packages from cache
40+
id: julia-cache
41+
uses: julia-actions/cache@v2
42+
- name: Build and deploy docs
43+
uses: julia-actions/julia-docdeploy@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
46+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
47+
GKSwstype: "100" # for Plots.jl plots (if you have them)
48+
JULIA_DEBUG: "Documenter"
49+
DATADEPS_ALWAYS_ACCEPT: true
50+
- name: Save Julia depot cache on cancel or failure
51+
id: julia-cache-save
52+
if: cancelled() || failure()
53+
uses: actions/cache/save@v4
54+
with:
55+
path: |
56+
${{ steps.julia-cache.outputs.cache-paths }}
57+
key: ${{ steps.julia-cache.outputs.cache-key }}

.github/workflows/TagBot.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ on:
44
types:
55
- created
66
workflow_dispatch:
7+
inputs:
8+
lookback:
9+
default: 3
10+
permissions:
11+
actions: read
12+
checks: read
13+
contents: write
14+
deployments: read
15+
issues: read
16+
discussions: read
17+
packages: read
18+
pages: read
19+
pull-requests: read
20+
repository-projects: read
21+
security-events: read
22+
statuses: read
723
jobs:
824
TagBot:
925
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
@@ -12,4 +28,4 @@ jobs:
1228
- uses: JuliaRegistries/TagBot@v1
1329
with:
1430
token: ${{ secrets.GITHUB_TOKEN }}
15-
ssh: ${{ secrets.DOCUMENTER_KEY }}
31+
ssh: ${{ secrets.DOCUMENTER_KEY }}

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ tmp_*
44
.vscode
55
Manifest.toml
66
.DS_Store
7-
*.csv
7+
*.csv
8+
9+
build/
10+
node_modules/
11+
package-lock.json
12+
Manifest.toml

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "EasyHybrid"
22
uuid = "61bb816a-e6af-4913-ab9e-91bff2e122e3"
3-
authors = ["Lazaro Alonso", "Markus Reichstein"]
3+
authors = ["Lazaro Alonso", "Bernhard Ahrens", "Markus Reichstein"]
44
version = "0.1.0"
55

66
[deps]

docs/Project.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365"
4+
EasyHybrid = "61bb816a-e6af-4913-ab9e-91bff2e122e3"
5+
6+
[sources]
7+
EasyHybrid = { path = ".." }

docs/make.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Documenter, DocumenterVitepress
2+
using EasyHybrid
3+
4+
makedocs(;
5+
modules=[EasyHybrid],
6+
authors="Lazaro Alonso, Markus Reichstein, Bernhard Ahrens",
7+
repo="https://github.com/EarthyScience/EasyHybrid",
8+
sitename="EasyHybrid",
9+
format=DocumenterVitepress.MarkdownVitepress(
10+
repo = "https://github.com/EarthyScience/EasyHybrid",
11+
devurl = "dev",
12+
),
13+
pages=[
14+
"Home" => "index.md",
15+
"Research" =>[
16+
"RbQ10" => "research/RbQ10_results.md"
17+
"BulkDensitySOC" => "research/BulkDensitySOC_results.md"
18+
],
19+
"API" => "api.md",
20+
],
21+
warnonly = true,
22+
)
23+
24+
DocumenterVitepress.deploydocs(;
25+
repo = "github.com/EarthyScience/EasyHybrid", # this must be the full URL!
26+
devbranch = "main",
27+
push_preview = true,
28+
)

docs/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"scripts": {
3+
"docs:dev": "vitepress dev build/.documenter",
4+
"docs:build": "vitepress build build/.documenter",
5+
"docs:preview": "vitepress preview build/.documenter"
6+
},
7+
"dependencies": {
8+
"@nolebase/vitepress-plugin-enhanced-readabilities": "^2.17.1",
9+
"markdown-it": "^14.1.0",
10+
"markdown-it-footnote": "^4.0.0",
11+
"markdown-it-mathjax3": "^4.3.2",
12+
"vitepress": "^1.6.3",
13+
"vitepress-plugin-tabs": "^0.6.0"
14+
}
15+
}

docs/src/api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# EasyHybrid.jl
2+
3+
Documentation for `EasyHybrid.jl`.
4+
5+
```@autodocs
6+
Modules=[EasyHybrid]
7+
```

docs/src/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
```@raw html
2+
---
3+
# https://vitepress.dev/reference/default-theme-home-page
4+
layout: home
5+
6+
hero:
7+
name: "EasyHybrid"
8+
tagline: combines machine learning with domain scientific modelling.
9+
features:
10+
- title: RbQ10
11+
details: What is this about?
12+
link: /research/RbQ10_results
13+
- title: BulkDensitySOC
14+
details: What's this about?
15+
link: /research/BulkDensitySOC_results
16+
---
17+
```

0 commit comments

Comments
 (0)