-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.18 KB
/
main.yml
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
name: Render and Deploy All Quarto Documents
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
render:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Git user
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Check if docs branch exists
id: check_docs_branch
run: |
if git show-ref --verify --quiet refs/heads/docs; then
echo "Branch docs exists"
echo "branch-exists=true" >> $GITHUB_ENV
else
echo "Branch docs does not exist"
echo "branch-exists=false" >> $GITHUB_ENV
fi
- name: Create docs branch if it does not exist
if: env.branch-exists == 'false'
run: |
git checkout -b docs
git push https://x-access-token:${{ secrets.MY_GITHUB_PAT }}@github.com/tensorchiefs/data.git docs
- name: Checkout docs branch if it exists
if: env.branch-exists == 'true'
run: |
git checkout docs
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install specific R packages
run: |
Rscript -e 'install.packages(c("rmarkdown", "ggplot2", "remotes"))'
Rscript -e 'remotes::install_github("tensorchiefs/data", subdir = "R/edudat", dependencies = TRUE, upgrade = "always", verbose = TRUE)'
- name: Render QMD files
run: |
quarto render data/*.qmd --to gfm
- name: Commit and push rendered files to docs branch
run: |
git add .
git commit -m 'Update rendered documentation' || echo "No changes to commit"
git push https://x-access-token:${{ secrets.MY_GITHUB_PAT }}@github.com/tensorchiefs/data.git docs
env:
GITHUB_PAT: ${{ secrets.MY_GITHUB_PAT }}
# Optional deployment step, commented out for now
# - name: Deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v3
# with:
# personal_token: ${{ secrets.MY_GITHUB_PAT }}
# publish_dir: ./data
# publish_branch: gh-docs