-
Notifications
You must be signed in to change notification settings - Fork 3
132 lines (107 loc) · 3.74 KB
/
deploy.yaml
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
name: buid_deploy
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2
- name: Install linux dependencies
run: |
sudo apt-get update
sudo apt-get install libxml2-dev libssl-dev libcurl4-openssl-dev libudunits2-dev libopenblas-base imagemagick
- name: Check R installation and variables
run: |
Rscript -e "print('R installation works!')"
echo "Github actor: ${GITHUB_ACTOR}"
echo "Github repository: ${GITHUB_REPOSITORY}"
echo "Folder contents at $(pwd):"
ls -lh
- name: Cache R packages
id: cache-rp
uses: actions/cache@v3
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-cache-rp
- name: Install R dependencies
if: steps.cache-rp.outputs.cache-hit != 'true'
run: |
Rscript -e 'install.packages(c("yaml","knitr","rmarkdown","purrr","DT"))'
echo "R directory size:"
du -sh /home/runner/work/_temp/Library
- name: Process images
run: |
# image processing using imagick convert
# crops to centered square and rescales to 100px x 100px
# masks to circular png
convert --version
if [[ ! -d trombinoscope/photo ]]
then
echo >&2 "Directory trombinoscope/photo doesn't exist."; exit 1;
fi
if [[ -d scaled ]]
then
rm -rf scaled
mkdir scaled
else
mkdir scaled
fi
# centered square crop
size='%[fx: w>h ? h : w ]'
offset_x='%[fx: w>h ? (w-h)/2 : 0 ]'
offset_y='%[fx: w>h ? 0 : (h-w)/2 ]'
viewport="${size}x${size}+${offset_x}+${offset_y}"
for i in trombinoscope/photo/*g
do
fname=$(basename $i | sed 's/\(^[a-z0-9|-]\+\)\(.*$\)/\1.png/g')
convert $i -set option:distort:viewport "$viewport" -filter point -distort SRT 0 +repage -adaptive-resize 100x100 scaled/${fname}
convert -size 100x100 xc:none -fill scaled/${fname} -draw "circle 50,50 50,1" scaled/${fname}
done
echo "Folder contents at $(pwd):"
ls -lh
echo "Folder contents at $(pwd)/scaled:"
ls -lh ./scaled/
- name: Render page
run: |
# Render website
Rscript -e "rmarkdown::render('index.Rmd')"
echo "Folder contents at $(pwd):"
ls -lh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: staff-artifact
path: |
index.html
index_files
assets
scaled
deploy:
runs-on: ubuntu-22.04
needs: build
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
contents: write
# Deploy to the github-pages environment
environment:
name: github-pages
steps:
- uses: actions/download-artifact@v4
with:
name: staff-artifact
- uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .