Repository navigation
102 lines (86 loc) · 2.74 KB
/
Copy pathpublish.yml
File metadata and controls
102 lines (86 loc) · 2.74 KB
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
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment; don't cancel an in-progress one.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout supplement
uses: actions/checkout@v4
- name: Checkout shared theme
uses: actions/checkout@v4
with:
repository: IHE/DEV.tooling
path: .tooling
sparse-checkout: theme
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Install Asciidoctor
run: |
gem install asciidoctor asciidoctor-pdf
- name: Prepare theme
run: |
mkdir -p output
# Combine base CSS + per-repo CSS (cascading, not replacing)
cat .tooling/theme/ihe-base.css > output/combined.css
if [ -f AsciiDoc_Source/theme/custom.css ]; then
echo "" >> output/combined.css
echo "/* === Per-repo custom styles === */" >> output/combined.css
cat AsciiDoc_Source/theme/custom.css >> output/combined.css
fi
# Copy base PDF theme where asciidoctor-pdf can find it
cp .tooling/theme/ihe-base-theme.yml output/ihe-base-theme.yml
- name: Build HTML
run: |
asciidoctor \
-b html5 \
-a stylesheet=combined.css \
-a linkcss \
-D output \
-o index.html \
AsciiDoc_Source/main.adoc
- name: Build PDF
run: |
asciidoctor-pdf \
-a pdf-theme=output/ihe-base-theme.yml \
-D output \
-o supplement.pdf \
AsciiDoc_Source/main.adoc
- name: Clean up build files
run: |
# Remove intermediate files from the artifact
rm -f output/ihe-base-theme.yml
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: supplement-output
path: output/
retention-days: 90
# Publish only from main. Pull requests build to verify, but a PR
# context cannot deploy to the Pages environment.
- name: Upload Pages artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: output/
- name: Deploy to GitHub Pages
id: deployment
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/deploy-pages@v4