Skip to content

Commit

Permalink
Deploy GitHub pages on every commit to main
Browse files Browse the repository at this point in the history
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
  • Loading branch information
arichardson committed Feb 6, 2024
1 parent 12dc8e2 commit 960ae2a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/build-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ on:
required: false
type: boolean
default: false
pages:
description: Deploy HTML to Github pages?
required: false
type: boolean
default: false
pull_request:
push:
branches:
- main
- automatic-pages-deployment

jobs:
build:
Expand All @@ -54,12 +50,17 @@ jobs:
run: docker pull riscvintl/riscv-docs-base-container-image:latest

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

- name: Update environment variables for push events
run: |
echo "EXTRA_ASCIIDOC_OPTIONS=-a github_commit_sha=$GITHUB_SHA" >> "$GITHUB_ENV"
if: github.event_name == 'push' && github.ref == 'refs/heads/automatic-pages-deployment'

# Build PDF and HTML.
- name: Build Files
run: make all
Expand All @@ -77,13 +78,13 @@ jobs:
# Upload GitHub pages artefacts.
- name: Make gitlab pages directory
run: mkdir dist && cp build/*.html dist/index.html
if: github.event_name == 'workflow_dispatch'
if: github.event_name == 'push'

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
if: github.event_name == 'workflow_dispatch'
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'

# Create Release
- name: Create Release
Expand All @@ -103,7 +104,7 @@ jobs:

# Deploy HTML to Github pages.
deploy:
if: github.event_name == 'workflow_dispatch' && github.event.inputs.pages
if: github.event_name == 'push' && github.ref == 'refs/heads/automatic-pages-deployment'

needs: build

Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ GEN_SRC = $(GEN_DIR)/both_mode_insns_table_body.adoc \

# AsciiDoctor command
ASCIIDOC = asciidoctor-pdf
EXTRA_ASCIIDOC_OPTIONS ?=

ASCIIDOC_OPTIONS = --trace \
-a compress \
Expand All @@ -96,7 +97,7 @@ ASCIIDOC_OPTIONS = --trace \
-a cheri_v9_annotations='' \
-a pdf-fontsdir=docs-resources/fonts \
-a pdf-theme=docs-resources/themes/riscv-pdf.yml \
--failure-level=ERROR
--failure-level=ERROR $(EXTRA_ASCIIDOC_OPTIONS)
ASCIIDOC_REQUIRES = --require=asciidoctor-bibtex \
--require=asciidoctor-diagram \
--require=asciidoctor-mathematical
Expand Down
6 changes: 6 additions & 0 deletions src/riscv-cheri.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ endif::[]
// Preface
///////////////////////////////////////////////////////////////////////////////

ifdef::github_commit_sha[]
[IMPORTANT]
This document is a specification snapshot built from https://github.com/riscv/riscv-cheri/commit/{github_commit_sha} and is not a versioned release.
The latest versioned PDF release can be downloaded from https://github.com/riscv/riscv-cheri/releases.
endif::[]

[WARNING]
.This document is in the link:http://riscv.org/spec-state[Development state]
====
Expand Down

0 comments on commit 960ae2a

Please sign in to comment.