-
Notifications
You must be signed in to change notification settings - Fork 8
103 lines (91 loc) · 3.32 KB
/
update_external_data.yml
File metadata and controls
103 lines (91 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Update External Data
on:
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
jobs:
update-external-data:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
path: repo
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: "release"
use-public-rspm: true
- name: Setup dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
working-directory: repo
extra-packages: any::pkgload, any::jsonlite, any::digest, bioc::bugsigdbr
- name: Build BugSigDB artifact
working-directory: repo
run: >
Rscript -e 'source("data-raw/build_bugsigdb.R");
build_bugsigdb_artifact(
output_dir = "build/external-data/bugsigdb/current",
base_url = "https://yulab-smu.github.io/MicrobiomeProfiler/datasets/bugsigdb/current"
)'
- name: Build eggNOG artifact
working-directory: repo
run: >
Rscript -e 'source("data-raw/build_eggnog.R");
build_eggnog_artifact(
output_dir = "build/external-data/eggnog/current",
base_url = "https://yulab-smu.github.io/MicrobiomeProfiler/datasets/eggnog/current"
)'
- name: Build Disbiome artifact
id: build_disbiome
continue-on-error: true
working-directory: repo
run: >
Rscript -e 'source("data-raw/build_disbiome.R");
build_disbiome_artifact(
output_dir = "build/external-data/disbiome/current",
base_url = "https://yulab-smu.github.io/MicrobiomeProfiler/datasets/disbiome/current",
timeout = 600
)'
- name: Report partial dataset update
if: always()
run: |
if [ "${{ steps.build_disbiome.outcome }}" != "success" ]; then
echo "::warning::Disbiome artifact update failed; keeping the previously published gh-pages version."
fi
- name: Prepare gh-pages worktree
working-directory: repo
run: |
rm -rf ../gh-pages
if git ls-remote --exit-code --heads origin gh-pages; then
git fetch origin gh-pages
git worktree add -B gh-pages ../gh-pages origin/gh-pages
else
git worktree add --detach ../gh-pages
cd ../gh-pages
git checkout --orphan gh-pages
git rm -rf . >/dev/null 2>&1 || true
fi
- name: Publish external data staging
working-directory: repo
run: >
Rscript -e 'source("data-raw/publish_external_data.R");
publish_external_data(
source_root = "build/external-data",
gh_pages_dir = "../gh-pages"
)'
- name: Commit and push gh-pages updates
working-directory: gh-pages
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add datasets index.json latest.json
if git diff --staged --quiet; then
echo "No external data changes to publish"
else
git commit -m "chore: update external data artifacts"
git push origin HEAD:gh-pages
fi