-
Notifications
You must be signed in to change notification settings - Fork 1
150 lines (127 loc) · 4.76 KB
/
vignette.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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
on:
push:
branches:
- "master"
pull_request:
branches:
- "*"
name: vignette
env:
cache-version: "cache-v2"
jobs:
check-permissions:
runs-on: ubuntu-latest
outputs:
has_permission: ${{ steps.check_permissions.outputs.has_permission }}
steps:
- name: Check if actor has permission
id: check_permissions
run: |
# Define allowed actors
ALLOWED_ACTORS=("zktuong" "Jiawei-Yu10") # Replace these with the actual GitHub usernames
if [[ " ${ALLOWED_ACTORS[@]} " =~ " ${GITHUB_ACTOR} " ]]; then
echo "has_permission=true" >> $GITHUB_OUTPUT
else
echo "has_permission=false" >> $GITHUB_OUTPUT
fi
- name: Debug permissions output
run: |
echo "Has permission: ${{ steps.check_permissions.outputs.has_permission }}"
vignette:
needs:
- check-permissions
if: needs.check-permissions.outputs.has_permission == 'true'
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
config:
- { os: ubuntu-latest }
runs-on: ${{ matrix.config.os }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Setup R and Bioconductor
uses: grimbough/bioc-actions/setup-bioc@v1
id: install-r
with:
bioc-version: devel
- name: Install ubuntu dependencies
if: ${{ matrix.config.os == 'ubuntu-latest' }}
run: |
sudo apt-get update && sudo apt-get install -y libgsl-dev
- name: Install macos dependencies
if: ${{ matrix.config.os == 'macos-latest' }}
run: |
brew install gsl
- name: Get R version
id: R
run: |
R --version > VERSION
echo "version=$(head -1 VERSION | awk '{print $3}')" >> $GITHUB_OUTPUT
shell: bash -l {0}
- name: Get Bioconductor version
id: BIOC
run: |
echo "version=$R_BIOC_VERSION" >> $GITHUB_OUTPUT
shell: bash -l {0}
- uses: r-lib/actions/setup-pandoc@v2
- name: Cache R packages
uses: actions/cache@v4
with:
path: /home/runner/work/_temp/Library
key: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-${{ steps.BIOC.outputs.version}}-r-${{ steps.R.outputs.version}}-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-${{ steps.BIOC.outputs.version}}-r-${{ steps.R.outputs.version}}-
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: pkgdown
- name: Install scRepertoire from github
run: |
Rscript -e 'remotes::install_github("ncborcherding/scRepertoire")'
shell: bash -l {0}
# - name: Install specific version of pillar to avoid weird error message
# run: |
# Rscript -e 'remotes::install_github("r-lib/[email protected]")'
# shell: bash -l {0}
- name: Install package
run: R CMD INSTALL .
- name: Configure git
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
- name: Build and publish vignette
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
shell: bash -l {0}
# If events is a PR, set subdir to 'preview/pr<pr_number>'
- name: "[PR] Set documentation subdirectory"
if: github.event_name == 'pull_request'
run: |
echo "PKGDOWN_DEV_MODE=unreleased" >> $GITHUB_ENV
echo "subdir=preview/pr${{ github.event.number }}" >> $GITHUB_ENV
- name: Deploy pkgdown site
id: deploy
shell: Rscript {0}
run: |
subdir <- "${{ env.subdir }}"
pkg <- pkgdown::as_pkgdown(".")
# Deploy pkgdown site to branch
pkgdown::deploy_to_branch(subdir = if (nzchar(subdir)) subdir, clean = nzchar(subdir))
# Report deployed site URL
deployed_url <- file.path(pkg$meta$url, subdir)
cat(sprintf('url=%s', deployed_url), file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE)
- name: Notify pkgdown deployment
if: github.event_name == 'pull_request'
uses: hasura/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: pkgdown-deploy
append: false
message: >
:book: ${{ steps.deploy.outputs.url }}
Preview documentation for this PR (at commit ${{ github.event.pull_request.head.sha }})