Skip to content

Create Specification Document #254

Create Specification Document

Create Specification Document #254

Workflow file for this run

---
name: Create Specification Document
# The workflow is triggered by pull request, push to main, and manual dispatch.
on:
workflow_dispatch:
inputs:
version:
description: 'Release version, e.g. X.Y.Z:'
required: true
type: string
revision_mark:
description: 'Set revision mark as Draft, Release or Stable:'
required: true
type: string
default: Draft
prerelease:
description: Tag as a pre-release?
required: false
type: boolean
default: true
draft:
description: Create release as a draft?
required: false
type: boolean
default: false
# pull_request:
# push:
# branches:
# - main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Normalize version input
id: ver
run: |
v='${{ github.event.inputs.version }}'
# Trim leading/trailing whitespace
v="$(echo "$v" | awk '{$1=$1; print}')"
# Drop leading 'v' or 'V'
v="${v#[Vv]}"
# Remove any internal spaces
v="${v//[[:space:]]/}"
echo "plain=$v" >> "$GITHUB_OUTPUT"
echo "tag=v$v" >> "$GITHUB_OUTPUT"
- name: Validate version format
run: |
v='${{ steps.ver.outputs.plain }}'
if ! [[ "$v" =~ ^[0-9]+(\.[0-9]+){1,2}(-[0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid version '$v'. Use formats like 0.2, 0.2.0, or 0.2.0-rc1"
exit 1
fi
- name: Pull Container
run: docker pull riscvintl/riscv-docs-base-container-image:latest
- name: Build Files
run: make
env:
VERSION: ${{ steps.ver.outputs.tag }} # e.g., v0.2.0
REVMARK: ${{ github.event.inputs.revision_mark }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: Build Artifacts
path: ${{ github.workspace }}/build/*.pdf
retention-days: 30
- name: Create Release
if: github.event_name == 'workflow_dispatch'
uses: softprops/action-gh-release@v2
with:
files: ${{ github.workspace }}/build/*.pdf
tag_name: ${{ steps.ver.outputs.tag }} # e.g., v0.2.0
name: Release ${{ steps.ver.outputs.plain }}
draft: ${{ github.event.inputs.draft }}
prerelease: ${{ github.event.inputs.prerelease }}
target_commitish: ${{ github.sha }}
env:
# Prefer the default token unless you have a reason to use a PAT.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}