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 }}