-
Notifications
You must be signed in to change notification settings - Fork 3
130 lines (110 loc) · 3.68 KB
/
build.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
name: build
on:
pull_request:
branches:
- main
workflow_dispatch:
push:
branches:
- 'main'
- 'test-build'
tags:
- "*"
env:
PARTICIPANT_DATA:
jobs:
build:
name: Build site
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: write
defaults:
run:
shell: bash -l {0}
steps:
- name: Cancel Previous Runs
if: ${{ !env.ACT }}
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Install micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: "1.3.1-0"
environment-file: conda-linux-64.lock
environment-name: pgip
init-shell: bash
cache-environment: true
- name: Install pgip dependencies
run: |
python -m ipykernel install --user --name pgip --display-name "Population Genomics in Practice (Python)"
python -m pip install git+https://github.com/NBISweden/pgip-tools
python -m pip install git+https://github.com/ksamuk/pixy.git
- name: Install dotenv
run: |
R -e "install.packages('dotenv', repos=c(CRAN = 'https://cran.rstudio.com/'))"
- name: Install TeXLive
run: |
sudo apt-get update
sudo apt-get install texlive texlive-latex-extra
- name: Install local pgip R package
run: |
R -e "library(devtools); devtools::install_local('src/R/pgip', upgrade=F)"
- name: Setup Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.3.450
- run: |
quarto --version
- name: Add miniconda path
run: |
echo "$(dirname $(which R))" >> $GITHUB_PATH
quarto check
- name: "Set environment variables"
run: |
echo "TEXINPUTS=$TEXINPUTS:$GITHUB_WORKSPACE/src/latex" >> $GITHUB_ENV
- name: Install dvisvgm
run: |
sudo apt-get install dvisvgm
- name: Render project without publishing
uses: quarto-dev/quarto-actions/render@v2
if: ${{ github.event_name == 'pull_request' }}
with:
path: docs
- name: Publish to GitHub Pages
uses: quarto-dev/quarto-actions/publish@v2
if: ${{ github.ref_name == 'main' || github.ref_name == 'test-build' }}
with:
target: gh-pages
path: docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout archived course versions
env:
GITHUB_EMAIL: [email protected]
GITHUB_USERNAME: gh_action
TARGET: gh_pages
run: |
# Add git info
git config --global user.email "${{ env.GITHUB_EMAIL }}"
git config --global user.name "${{ env.GITHUB_USERNAME }}"
git checkout ${{ env.TARGET }}
mkdir -p archive
cd archive
# Add archive index page
cat .header.html > index.html
# Loop tags that match v\d+
for tag in $(git tag --list v[0-9][0-9][0-9][0-9]); do
git clone --depth 1 $tag
contents=$(git tag -n 100 $tag --format "%(contents)")
echo "<section id=\"$tag\" class=\"level3\">" >> index.html
echo "<h3 class=\"anchored\" data-anchor-id=\"$tag\">" >> index.html
echo "<a href=\"$link\">$tag</a>" >> index.html
echo "</h3>" >> index.html
echo "<p>$contents</p>" >> index.html
echo "</section>" >> index.html
done
cat .footer.html >> index.html