forked from riscv/riscv-isa-manual
-
Notifications
You must be signed in to change notification settings - Fork 3
183 lines (161 loc) · 6.68 KB
/
isa-build.yml
File metadata and controls
183 lines (161 loc) · 6.68 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
name: RISC-V ISA Build
on:
workflow_dispatch:
inputs:
create_release:
description: Create a new RISC-V ISA release if set to true
required: false
default: 'false'
target_branch:
description: Target Branch
required: true
default: main
release_notes:
description: Release Notes
required: false
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: recursive
# Set the short SHA for use in artifact names
- name: Set short SHA
run: echo "SHORT_SHA=$(echo ${GITHUB_SHA::7})" >> $GITHUB_ENV
# Get the current date
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
# Build PDF and HTML ISA manual versions and normative rule files using the container
- name: Build Files
id: build_files
run: make -j$(nproc)
# Upload the riscv-privileged PDF file
- name: Upload riscv-privileged.pdf
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: riscv-privileged-${{ env.SHORT_SHA }}.pdf
path: ${{ github.workspace }}/build/riscv-privileged.pdf
retention-days: 7
# Upload the riscv-privileged HTML file
- name: Upload riscv-privileged.html
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: riscv-privileged-${{ env.SHORT_SHA }}.html
path: ${{ github.workspace }}/build/riscv-privileged.html
retention-days: 7
# Upload the riscv-privileged EPUB file
- name: Upload riscv-privileged.epub
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: riscv-privileged-${{ env.SHORT_SHA }}.epub
path: ${{ github.workspace }}/build/riscv-privileged.epub
retention-days: 7
# Upload the riscv-unprivileged PDF file
- name: Upload riscv-unprivileged.pdf
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: riscv-unprivileged-${{ env.SHORT_SHA }}.pdf
path: ${{ github.workspace }}/build/riscv-unprivileged.pdf
retention-days: 7
# Upload the riscv-unprivileged HTML file
- name: Upload riscv-unprivileged.html
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: riscv-unprivileged-${{ env.SHORT_SHA }}.html
path: ${{ github.workspace }}/build/riscv-unprivileged.html
retention-days: 7
# Upload the riscv-unprivileged EPUB file
- name: Upload riscv-unprivileged.epub
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: riscv-unprivileged-${{ env.SHORT_SHA }}.epub
path: ${{ github.workspace }}/build/riscv-unprivileged.epub
retention-days: 7
# Upload norm-rules.html
- name: Upload norm-rules.html
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: norm-rules-${{ env.SHORT_SHA }}.html
path: ${{ github.workspace }}/build/norm-rules.html
retention-days: 7
# Upload norm-rules.json
- name: Upload norm-rules.json
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: norm-rules-${{ env.SHORT_SHA }}.json
path: ${{ github.workspace }}/build/norm-rules.json
retention-days: 7
- name: Create Release
if: steps.build_files.outcome == 'success' && github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true'
#uses: softprops/action-gh-release@v2.2.2
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b
with:
draft: false
tag_name: riscv-isa-release-${{ env.SHORT_SHA }}-${{ env.CURRENT_DATE }}
name: ${{ env.CURRENT_DATE }}
body: |
This release was created by: ${{ github.event.sender.login }}
Release Notes: ${{ github.event.inputs.release_notes }}
files: |
${{ github.workspace }}/build/riscv-privileged.pdf
${{ github.workspace }}/build/riscv-privileged.html
${{ github.workspace }}/build/riscv-privileged.epub
${{ github.workspace }}/build/riscv-unprivileged.pdf
${{ github.workspace }}/build/riscv-unprivileged.html
${{ github.workspace }}/build/riscv-unprivileged.epub
${{ github.workspace }}/build/norm-rules.html
${{ github.workspace }}/build/norm-rules.json
env:
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
# Create directory structure pages sites for privileged and unprivileged ISA manuals and normative rule files.
# Copy priv/unpriv ISA manual HTML also into norm-rules directory so hyperlinks from
# norm-rules.html into the ISA manual are found (matches local build).
- name: Make GitHub pages directory
run: |
mkdir -p dist/snapshot/unprivileged dist/snapshot/privileged dist/snapshot/norm-rules
cp build/riscv-unprivileged.html dist/snapshot/unprivileged/index.html
cp build/riscv-privileged.html dist/snapshot/privileged/index.html
cp build/norm-rules.html dist/snapshot/norm-rules/index.html
cp build/norm-rules.html dist/snapshot/norm-rules/norm-rules.html
cp build/norm-rules.json dist/snapshot/norm-rules/norm-rules.json
cp build/riscv-unprivileged.html dist/snapshot/norm-rules/riscv-unprivileged.html
cp build/riscv-privileged.html dist/snapshot/norm-rules/riscv-privileged.html
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: dist
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
# Deploy HTML to GitHub pages.
deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4