-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (131 loc) · 5.32 KB
/
gh-pages.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
151
152
153
154
name: Publish on GitHub pages
on:
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: '0 7 * * 2'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
HUGO_VERSION: 0.132.2
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
# - name: Maximize build space
# uses: easimon/maximize-build-space@master
# with:
# root-reserve-mb: 4096
# temp-reserve-mb: 1096
# remove-android: 'true'
# remove-haskell: 'true'
# remove-codeql: 'true'
# remove-dotnet: 'true'
- name: Free some disk space
run: |
sudo rm -rf /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL /usr/local/graalvm/ /usr/local/share/powershell /usr/local/lib/android /usr/local/lib/node_modules /usr/local/.ghcup/ /usr/share/dotnet/
- uses: actions/checkout@v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
- name: Login to GitHub Packages Docker Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
logout: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install required dependencies
run: |
./scripts/github-setup.sh
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
- name: Create IIIF derivates
# UID is als available via $(id -u)
run: |
echo "Running as ${UID}"
docker run -e CHOWN_UID=${UID} -e URL_PREFIX="https://static.projektemacher.org/blaufusstoelpel/" -v ${PWD}:${PWD} ghcr.io/cmahnke/iiif-action:latest-jxl-uploader sh -c "cd ${PWD} && ./scripts/iiif.sh"
- name: Setup deploy env
env:
DEPLOY_SSH_IDENTITY: ${{ secrets.DEPLOY_SSH_IDENTITY }}
run: |
mkdir -p ~/.ssh && echo "$DEPLOY_SSH_IDENTITY" >> ~/.ssh/known_hosts
- name: IIIF directory upload and cleanup
env:
DEPLOY_SERVER: ${{ secrets.DEPLOY_SERVER }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
SSHPASS: ${{ secrets.DEPLOY_PASS }}
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
run: |
cd content
find post -name info.json -exec dirname {} \; > files.lst
cp ../blaufusstoelpel-redirect/index.html .
echo "index.html" >> files.lst
cat files.lst | xargs chmod 775
sshpass -e rsync -aP --size-only --delete --relative $(cat files.lst) $DEPLOY_USER@$DEPLOY_SERVER:$DEPLOY_PATH/blaufusstoelpel/
rm -f files.lst index.html
cd ..
find content/post/ -name info.json -exec dirname {} \; | xargs -I {} find {} -mindepth 1 -type d -not -path '*/full*' | xargs rm -rf
#find content/post/ -name info.json -exec dirname {} \; | xargs rm -r
- name: Generate Files
env:
SKIP_IIIF: yes
run: |
./scripts/setup.sh
# - name: Upload IIIF directories
# run: |
# cd ftp
# sshpass -p "$DEPLOY_PASS" rsync --delete -aP * $DEPLOY_USER@$DEPLOY_SERVER:$DEPLOY_PATH
# cd ..
# mkdir ftp
# This needs the packages sshpass ssh-client
# tar cf - * | sshpass -p$DEPLOY_PASS ssh $DEPLOY_USER@$DEPLOY_SERVER "cd $DEPLOY_PATH && rm -rf blaufusstoelpel && mkdir -p blaufusstoelpel && cd blaufusstoelpel && tar xvf - && chmod -R 775 ../blaufusstoelpel"
# This needs the package lftp
# set ftp:ssl-force true; set passive-mode true; set ftp:ssl-protect-data true
# lftp ftp://$DEPLOY_SERVER -u $DEPLOY_USER,$DEPLOY_PASS -e 'set ftp:ssl-force true; set mirror:parallel-directories true; set passive-mode true; set ftp:ssl-protect-data true; mkdir -p blaufusstoelpel; mirror -P 8 -v -R --delete ftp/ blaufusstoelpel/; chmod -Rf 0777 blaufusstoelpel; exit'
- name: Setup Hugo
uses: peaceiris/[email protected]
with:
hugo-version: ${{ env.HUGO_VERSION }}
extended: true
- name: Generate stats
run: |
./themes/projektemacher-base/scripts/stat.sh
- name: Build Hugo site
run: hugo --printI18nWarnings --printUnusedTemplates
- name: Validate JSON
env:
OSTYPE: linux
run: |
yarn run validate
- name: Cleanup Build
run: |
echo "Removing files not needed to be deployed on GitHub Pages"
find docs -type f -size +10M -name '*.jpg' -print -exec rm {} \;
find docs -type f -name '*.jxl' -print -exec rm {} \;
find docs -type f -name 'vips-properties.xml' -print -exec rm {} \;
find docs -type f -path '*/full/full/0/default.jpg' -print -exec rm {} \;
rm -rf docs/plugins
# - name: Cleanup disk
# run: |
# df -h
# docker rmi -f ghcr.io/cmahnke/iiif-action:latest
# du -chs *
# rm -rf node_modules content ftp
# df -h
- name: Puppeteer
run: ./themes/projektemacher-base/scripts/github/check-js-errors.sh
- name: Deploy site
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
force_orphan: true