Fix issue 42 #64
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
pages: | |
description: 'Deploy HTML to Github pages?' | |
required: false | |
type: boolean | |
default: false | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
# Pull the latest RISC-V Docs container image | |
- name: Pull Container | |
run: docker pull riscvintl/riscv-docs-base-container-image:latest | |
# Build PDF and HTML. | |
- name: Build Files | |
run: make all | |
env: | |
VERSION: v${{ github.event.inputs.version }} | |
REVMARK: ${{ github.event.inputs.revision_mark }} | |
# Upload the built PDF and HTML files as a single artifact | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Build Artifacts | |
path: | | |
build/*.pdf | |
build/*.html | |
retention-days: 30 | |
# Upload gitlab pages artefact. | |
- name: Make gitlab pages directory | |
run: mkdir dist && cp build/*.html dist/index.html | |
if: github.event_name == 'workflow_dispatch' | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: dist | |
if: github.event_name == 'workflow_dispatch' | |
# Create Release | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
build/*.pdf | |
build/*.html | |
tag_name: v${{ github.event.inputs.version }} | |
name: Release ${{ github.event.inputs.version }} | |
draft: ${{ github.event.inputs.draft }} | |
prerelease: ${{ github.event.inputs.prerelease }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHTOKEN }} | |
if: github.event_name == 'workflow_dispatch' | |
# This condition ensures this step only runs for workflow_dispatch events. | |
# Deploy HTML to Github pages. | |
deploy: | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.pages | |
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 |