Skip to content

Commit ecae751

Browse files
Experimental pages build.
1 parent cd1cda5 commit ecae751

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

.github/workflows/mirror.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Sample workflow for building and deploying a mdBook site to GitHub Pages
2+
#
3+
# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html
4+
#
5+
name: Build deployable static site mirror archives
6+
7+
on:
8+
# Runs on pushes targeting the default branch
9+
push:
10+
branches: ["main"]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: write
18+
id-token: write
19+
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
22+
concurrency:
23+
group: "pages"
24+
cancel-in-progress: false
25+
26+
jobs:
27+
# Build job
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
- name: Build a pages artifact
34+
run: "bash sh/ghGenerate.sh"
35+
- name: Rewrite release
36+
uses: ncipollo/release-action@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
artifacts: "pages-build.tar.gz,pages-build-gz.tar,pages-build-br.tar,build-time.txt"
41+
allowUpdates: true
42+
artifactErrorsFailBuild: true
43+
makeLatest: false
44+
prerelease: true
45+
removeArtifacts: true
46+
replacesArtifacts: true
47+
name: "Latest page build"
48+
tag: "pages-build"

sh/ghGenerate.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
COMPRESS_CRIT="\.(bin|bm|bmp|conf|css|csv|htm|html|ico|js|json|kar|list|lst|map|md|mid|mjs|mod|otf|svg|tsv|ttf|vgm|wasm|webmanifest|xml)$"
3+
echo "$(date +"%s")" > build-time.txt
4+
cp -Lrv ghp ghp-gz
5+
cp -Lrv ghp ghp-br
6+
cd ghp
7+
tar cvf ../pages-build.tar *
8+
cd ..
9+
zopfli --i1 -v pages-build.tar
10+
rm -v pages-build.tar
11+
cd ghp-gz
12+
tree -ifl | grep -E "${COMPRESS_CRIT}" | while IFS= read -r file; do
13+
zopfli --i1 "$file"
14+
if [ -f "$file" ]; then
15+
rm -v "$file"
16+
fi
17+
done
18+
tar cvf ../pages-build-gz.tar *
19+
cd ..
20+
cd ghp-br
21+
tree -ifl | grep -E "${COMPRESS_CRIT}" | while IFS= read -r file; do
22+
brotli -vq 11 "$file"
23+
if [ -f "$file" ]; then
24+
rm -v "$file"
25+
fi
26+
done
27+
tar cvf ../pages-build-br.tar *
28+
cd ..
29+
exit

0 commit comments

Comments
 (0)