-
Notifications
You must be signed in to change notification settings - Fork 643
120 lines (106 loc) · 4.05 KB
/
isa-build.yml
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
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@v3
# 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
# Pull the latest RISC-V Docs container image
# https://github.com/riscv/riscv-docs-base-container-image
# https://hub.docker.com/r/riscvintl/riscv-docs-base-container-image
- name: Pull Container
id: pull_container_image
run: |
docker pull riscvintl/riscv-docs-base-container-image:latest
# Build PDF and HTML files using the container
- name: Build Files
id: build_files
if: steps.pull_container_image.outcome == 'success'
run: |
docker run --rm -v ${{ github.workspace }}:/build riscvintl/riscv-docs-base-container-image:latest \
/bin/sh -c 'cd ./build && make'
# Upload the priv-isa-asciidoc PDF file
- name: Upload priv-isa-asciidoc.pdf
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: priv-isa-asciidoc-${{ env.SHORT_SHA }}.pdf
path: ${{ github.workspace }}/build/priv-isa-asciidoc.pdf
retention-days: 7
# Upload the priv-isa-asciidoc HTML file
- name: Upload priv-isa-asciidoc.html
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: priv-isa-asciidoc-${{ env.SHORT_SHA }}.html
path: ${{ github.workspace }}/build/priv-isa-asciidoc.html
retention-days: 7
# Upload the unpriv-isa-asciidoc PDF file
- name: Upload unpriv-isa-asciidoc.pdf
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: unpriv-isa-asciidoc-${{ env.SHORT_SHA }}.pdf
path: ${{ github.workspace }}/build/unpriv-isa-asciidoc.pdf
retention-days: 7
# Upload the unpriv-isa-asciidoc HTML file
- name: Upload unpriv-isa-asciidoc.html
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: unpriv-isa-asciidoc-${{ env.SHORT_SHA }}.html
path: ${{ github.workspace }}/build/unpriv-isa-asciidoc.html
retention-days: 7
# Upload the priv-isa-latex PDF file
- name: Upload riscv-privileged.pdf
if: steps.build_files.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: riscv-privileged-latex-${{ env.SHORT_SHA }}.pdf
path: ${{ github.workspace }}/build/riscv-privileged.pdf
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@v1
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/priv-isa-asciidoc.pdf
${{ github.workspace }}/build/priv-isa-asciidoc.html
${{ github.workspace }}/build/unpriv-isa-asciidoc.pdf
${{ github.workspace }}/build/unpriv-isa-asciidoc.html
${{ github.workspace }}/build/riscv-privileged.pdf
env:
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}