Skip to content

Commit 9b41bba

Browse files
committed
Sync workflow and readme with the template repository
This adds a new pre-commit checker (`pre-commit install` to set up locally)
1 parent b87760e commit 9b41bba

File tree

4 files changed

+94
-50
lines changed

4 files changed

+94
-50
lines changed

.github/workflows/build-pdf.yml

+48-47
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Create Specification Document
23

34
# The workflow is triggered by pull request, push to main, and manual dispatch.
@@ -9,22 +10,22 @@ on:
910
required: true
1011
type: string
1112
revision_mark:
12-
description: 'Set revision mark as Draft, Release or Stable:'
13-
required: true
14-
type: string
15-
default: 'Draft'
13+
description: 'Set revision mark as Draft, Release or Stable:'
14+
required: true
15+
type: string
16+
default: Draft
1617
prerelease:
17-
description: 'Tag as a pre-release?'
18+
description: Tag as a pre-release?
1819
required: false
1920
type: boolean
2021
default: true
2122
draft:
22-
description: 'Create release as a draft?'
23+
description: Create release as a draft?
2324
required: false
2425
type: boolean
2526
default: false
2627
pages:
27-
description: 'Deploy HTML to Github pages?'
28+
description: Deploy HTML to Github pages?
2829
required: false
2930
type: boolean
3031
default: false
@@ -39,57 +40,57 @@ jobs:
3940

4041
steps:
4142
# Checkout the repository
42-
- name: Checkout repository
43-
uses: actions/checkout@v3
44-
with:
45-
submodules: 'recursive'
43+
- name: Checkout repository
44+
uses: actions/checkout@v3
45+
with:
46+
submodules: recursive
4647

4748
# Pull the latest RISC-V Docs container image
48-
- name: Pull Container
49-
run: docker pull riscvintl/riscv-docs-base-container-image:latest
49+
- name: Pull Container
50+
run: docker pull riscvintl/riscv-docs-base-container-image:latest
5051

5152
# Build PDF and HTML.
52-
- name: Build Files
53-
run: make all
54-
env:
55-
VERSION: v${{ github.event.inputs.version }}
56-
REVMARK: ${{ github.event.inputs.revision_mark }}
53+
- name: Build Files
54+
run: make all
55+
env:
56+
VERSION: v${{ github.event.inputs.version }}
57+
REVMARK: ${{ github.event.inputs.revision_mark }}
5758

5859
# Upload the built PDF and HTML files as a single artifact
59-
- name: Upload Build Artifacts
60-
uses: actions/upload-artifact@v3
61-
with:
62-
name: Build Artifacts
63-
path: |
64-
build/*.pdf
65-
build/*.html
66-
retention-days: 30
60+
- name: Upload Build Artifacts
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: Build Artifacts
64+
path: |
65+
build/*.pdf
66+
build/*.html
67+
retention-days: 30
6768

6869
# Upload gitlab pages artefact.
69-
- name: Make gitlab pages directory
70-
run: mkdir dist && cp build/*.html dist/index.html
71-
if: github.event_name == 'workflow_dispatch'
70+
- name: Make gitlab pages directory
71+
run: mkdir dist && cp build/*.html dist/index.html
72+
if: github.event_name == 'workflow_dispatch'
7273

73-
- name: Upload artifact
74-
uses: actions/upload-pages-artifact@v3
75-
with:
76-
path: dist
77-
if: github.event_name == 'workflow_dispatch'
74+
- name: Upload artifact
75+
uses: actions/upload-pages-artifact@v3
76+
with:
77+
path: dist
78+
if: github.event_name == 'workflow_dispatch'
7879

7980
# Create Release
80-
- name: Create Release
81-
uses: softprops/action-gh-release@v1
82-
with:
83-
files: |
84-
build/*.pdf
85-
build/*.html
86-
tag_name: v${{ github.event.inputs.version }}
87-
name: Release ${{ github.event.inputs.version }}
88-
draft: ${{ github.event.inputs.draft }}
89-
prerelease: ${{ github.event.inputs.prerelease }}
90-
env:
91-
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
92-
if: github.event_name == 'workflow_dispatch'
81+
- name: Create Release
82+
uses: softprops/action-gh-release@v1
83+
with:
84+
files: |
85+
build/*.pdf
86+
build/*.html
87+
tag_name: v${{ github.event.inputs.version }}
88+
name: Release ${{ github.event.inputs.version }}
89+
draft: ${{ github.event.inputs.draft }}
90+
prerelease: ${{ github.event.inputs.prerelease }}
91+
env:
92+
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
93+
if: github.event_name == 'workflow_dispatch'
9394
# This condition ensures this step only runs for workflow_dispatch events.
9495

9596
# Deploy HTML to Github pages.

.github/workflows/pre-commit.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: pre-commit
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v3
15+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.5.0
5+
hooks:
6+
- id: check-json
7+
- id: check-symlinks
8+
- id: check-yaml
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
args: [--markdown-linebreak-ext=md]
12+
13+
- repo: local
14+
hooks:
15+
- id: forbidden-file-extensions
16+
name: forbidden-file-extensions
17+
entry: disallow these file extensions
18+
language: fail
19+
# Disallow other asciidoc extensions except .adoc
20+
files: .*\.(asciidoc|asc)$
21+
22+
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
23+
rev: 0.2.3
24+
hooks:
25+
- id: yamlfmt
26+
args: [--mapping, '2', --sequence, '4', --offset, '2']

readme.adoc

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This work is licensed under a Creative Commons Attribution 4.0 International Lic
88

99
== Contributors
1010

11-
The list of contributors to this specification is maintained in the link:contributors.adoc[contributors] file.
11+
The list of contributors to this specification is maintained in the link:src/contributors.adoc[contributors] file.
1212

1313
For guidelines on how to contribute, refer to the link:CONTRIBUTING.md[CONTRIBUTING] file.
1414

@@ -25,13 +25,15 @@ To build the document, you'll need the following tools installed on your system:
2525

2626
=== Cloning the Repository
2727

28-
`git clone --recurse-submodules https://github.com/riscv/riscv-cheri.git`
28+
```shell
29+
git clone --recurse-submodules https://github.com/riscv/riscv-cheri.git
30+
```
2931

3032
=== Building the Documentation
3133

3234
To start the build process, run `cd ./riscv-cheri && make all`.
3335

34-
The Makefile script will check the availability of Docker on your system:
36+
The link:Makefile[] script will check the availability of Docker on your system:
3537

3638
* If Docker is available, the documentation will be built inside a Docker container using the image riscvintl/riscv-docs-base-container-image:latest. This ensures a consistent build environment across different systems.
3739
* If Docker is not available, the documentation will be built directly on your system using the installed tools.

0 commit comments

Comments
 (0)