Skip to content

Commit 7237349

Browse files
authored
Deploy GitHub pages on every commit to main (#89)
This adds a note to the generated HTML that this page is a snapshot and the PDF should be treated as the latest source. Automatically deploying each commit to https://riscv.github.io/riscv-cheri/ makes it easier to read the latest snapshot version of the spec without requiring a new release. Fixes: #74
1 parent 12dc8e2 commit 7237349

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

Diff for: .github/workflows/build-pdf.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ on:
2828
required: false
2929
type: boolean
3030
default: false
31-
pages:
32-
description: Deploy HTML to Github pages?
33-
required: false
34-
type: boolean
35-
default: false
3631
pull_request:
3732
push:
3833
branches:
@@ -54,12 +49,17 @@ jobs:
5449
run: docker pull riscvintl/riscv-docs-base-container-image:latest
5550

5651
# Override VERSION and REVMARK for manual workflow dispatch
57-
- name: Update environment variables
52+
- name: Update environment variables for releases
5853
run: |
5954
echo "VERSION=v${{ github.event.inputs.version }}" >> "$GITHUB_ENV"
6055
echo "REVMARK=${{ github.event.inputs.revision_mark }}" >> "$GITHUB_ENV"
6156
if: github.event_name == 'workflow_dispatch'
6257

58+
- name: Update environment variables for push events
59+
run: |
60+
echo "EXTRA_ASCIIDOC_OPTIONS=-a github_commit_sha=$GITHUB_SHA" >> "$GITHUB_ENV"
61+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
62+
6363
# Build PDF and HTML.
6464
- name: Build Files
6565
run: make all
@@ -77,13 +77,13 @@ jobs:
7777
# Upload GitHub pages artefacts.
7878
- name: Make gitlab pages directory
7979
run: mkdir dist && cp build/*.html dist/index.html
80-
if: github.event_name == 'workflow_dispatch'
80+
if: github.event_name == 'push'
8181

8282
- name: Upload artifact
8383
uses: actions/upload-pages-artifact@v3
8484
with:
8585
path: dist
86-
if: github.event_name == 'workflow_dispatch'
86+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
8787

8888
# Create Release
8989
- name: Create Release
@@ -103,7 +103,7 @@ jobs:
103103

104104
# Deploy HTML to Github pages.
105105
deploy:
106-
if: github.event_name == 'workflow_dispatch' && github.event.inputs.pages
106+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
107107

108108
needs: build
109109

Diff for: Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ GEN_SRC = $(GEN_DIR)/both_mode_insns_table_body.adoc \
8282

8383
# AsciiDoctor command
8484
ASCIIDOC = asciidoctor-pdf
85+
EXTRA_ASCIIDOC_OPTIONS ?=
8586

8687
ASCIIDOC_OPTIONS = --trace \
8788
-a compress \
@@ -96,7 +97,7 @@ ASCIIDOC_OPTIONS = --trace \
9697
-a cheri_v9_annotations='' \
9798
-a pdf-fontsdir=docs-resources/fonts \
9899
-a pdf-theme=docs-resources/themes/riscv-pdf.yml \
99-
--failure-level=ERROR
100+
--failure-level=ERROR $(EXTRA_ASCIIDOC_OPTIONS)
100101
ASCIIDOC_REQUIRES = --require=asciidoctor-bibtex \
101102
--require=asciidoctor-diagram \
102103
--require=asciidoctor-mathematical

Diff for: src/riscv-cheri.adoc

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ endif::[]
9090
// Preface
9191
///////////////////////////////////////////////////////////////////////////////
9292

93+
ifdef::github_commit_sha[]
94+
[IMPORTANT]
95+
This document is a specification snapshot built from https://github.com/riscv/riscv-cheri/commit/{github_commit_sha} and is not a versioned release.
96+
The latest versioned PDF release can be downloaded from https://github.com/riscv/riscv-cheri/releases.
97+
endif::[]
98+
9399
[WARNING]
94100
.This document is in the link:http://riscv.org/spec-state[Development state]
95101
====

0 commit comments

Comments
 (0)