|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout supplement |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Checkout shared theme |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + repository: IHE/DEV.tooling |
| 23 | + path: .tooling |
| 24 | + sparse-checkout: theme |
| 25 | + |
| 26 | + - name: Setup Ruby |
| 27 | + uses: ruby/setup-ruby@v1 |
| 28 | + with: |
| 29 | + ruby-version: '3.3' |
| 30 | + bundler-cache: true |
| 31 | + |
| 32 | + - name: Install Asciidoctor |
| 33 | + run: | |
| 34 | + gem install asciidoctor asciidoctor-pdf |
| 35 | +
|
| 36 | + - name: Prepare theme |
| 37 | + run: | |
| 38 | + mkdir -p output |
| 39 | +
|
| 40 | + # Combine base CSS + per-repo CSS (cascading, not replacing) |
| 41 | + cat .tooling/theme/ihe-base.css > output/combined.css |
| 42 | + if [ -f AsciiDoc_Source/theme/custom.css ]; then |
| 43 | + echo "" >> output/combined.css |
| 44 | + echo "/* === Per-repo custom styles === */" >> output/combined.css |
| 45 | + cat AsciiDoc_Source/theme/custom.css >> output/combined.css |
| 46 | + fi |
| 47 | +
|
| 48 | + # Copy base PDF theme where asciidoctor-pdf can find it |
| 49 | + cp .tooling/theme/ihe-base-theme.yml output/ihe-base-theme.yml |
| 50 | +
|
| 51 | + - name: Build HTML |
| 52 | + run: | |
| 53 | + asciidoctor \ |
| 54 | + -b html5 \ |
| 55 | + -a stylesheet=../output/combined.css \ |
| 56 | + -a linkcss \ |
| 57 | + -D output \ |
| 58 | + -o index.html \ |
| 59 | + AsciiDoc_Source/main.adoc |
| 60 | +
|
| 61 | + - name: Build PDF |
| 62 | + run: | |
| 63 | + asciidoctor-pdf \ |
| 64 | + -a pdf-theme=output/ihe-base-theme.yml \ |
| 65 | + -D output \ |
| 66 | + -o supplement.pdf \ |
| 67 | + AsciiDoc_Source/main.adoc |
| 68 | +
|
| 69 | + - name: Clean up build files |
| 70 | + run: | |
| 71 | + # Remove intermediate files from the artifact |
| 72 | + rm -f output/ihe-base-theme.yml |
| 73 | +
|
| 74 | + - name: Upload build artifacts |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: supplement-output |
| 78 | + path: output/ |
| 79 | + retention-days: 90 |
0 commit comments