blob: 80ecf5d718f45cbd4d4f9249a1d6a0768f1982d0 (
plain)
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
|
name: build-epubs
on:
schedule:
- cron: "0 6 * * *" # daily, to catch master/new releases
push:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: codeberg-small-lazy
steps:
- name: Install prerequisites
run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl xz-utils git
- uses: actions/checkout@v4
- name: Install Zig 0.15.2
run: |
set -eux
arch="$(uname -m)"
tarball="zig-${arch}-linux-0.15.2.tar.xz"
curl -fSL "https://ziglang.org/download/0.15.2/${tarball}" -o /tmp/zig.tar.xz
mkdir -p /opt/zig
tar -xJf /tmp/zig.tar.xz -C /opt/zig --strip-components=1
echo "/opt/zig" >> "$GITHUB_PATH"
- name: Build EPUBs
run: zig build run
- name: Commit updated EPUBs
run: |
set -eux
git config user.name "ziggy"
git config user.email "ziggy@noreply.codeberg.org"
git add epubs/
if git diff --cached --quiet; then
echo "No EPUB changes."
exit 0
fi
git commit -m "build: update epubs [skip ci]"
# Uses the runner token by default; set CI_PUSH_TOKEN if it lacks push rights.
if [ -n "${CI_PUSH_TOKEN:-}" ]; then
git push "https://x-access-token:${CI_PUSH_TOKEN}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" HEAD:main
else
git push origin HEAD:main
fi
env:
CI_PUSH_TOKEN: ${{ secrets.CI_PUSH_TOKEN }}
|