|
| 1 | +--- |
| 2 | +name: Create Specification Document |
| 3 | + |
| 4 | +# The workflow is triggered by pull request, push to main, and manual dispatch. |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + revision_mark: |
| 9 | + description: 'Set revision mark as Draft, Release or Stable:' |
| 10 | + required: true |
| 11 | + type: choice |
| 12 | + options: |
| 13 | + - Development |
| 14 | + - Stable |
| 15 | + - Frozen |
| 16 | + - Ratified |
| 17 | + default: Development |
| 18 | + prerelease: |
| 19 | + description: Tag as a pre-release? |
| 20 | + required: false |
| 21 | + type: boolean |
| 22 | + default: true |
| 23 | + draft: |
| 24 | + description: Create release as a draft? |
| 25 | + required: false |
| 26 | + type: boolean |
| 27 | + default: false |
| 28 | + pull_request: |
| 29 | + push: |
| 30 | + branches: |
| 31 | + - main |
| 32 | + |
| 33 | +jobs: |
| 34 | + build: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + |
| 37 | + steps: |
| 38 | + # Checkout the repository |
| 39 | + - name: Checkout repository |
| 40 | + uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + submodules: recursive |
| 43 | + |
| 44 | + - name: Get next version |
| 45 | + uses: reecetech/version-increment@2024.4.4 |
| 46 | + id: version |
| 47 | + with: |
| 48 | + scheme: semver |
| 49 | + increment: patch |
| 50 | + |
| 51 | + # Pull the latest RISC-V Docs container image |
| 52 | + - name: Pull Container |
| 53 | + run: docker pull riscvintl/riscv-docs-base-container-image:latest |
| 54 | + |
| 55 | + # Override VERSION and REVMARK for manual workflow dispatch |
| 56 | + - name: Update environment variables |
| 57 | + run: | |
| 58 | + echo "VERSION=v${{ steps.version.outputs.version }}" >> "$GITHUB_ENV" |
| 59 | + echo "REVMARK=${{ github.event.inputs.revision_mark }}" >> "$GITHUB_ENV" |
| 60 | + if: github.event_name == 'workflow_dispatch' |
| 61 | + |
| 62 | + # Build Files |
| 63 | + - name: Build Files |
| 64 | + run: make |
| 65 | + |
| 66 | + # Upload the built PDF files as a single artifact |
| 67 | + - name: Upload Build Artifacts |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + name: Build Artifacts |
| 71 | + path: ${{ github.workspace }}/build/*.pdf |
| 72 | + retention-days: 30 |
| 73 | + |
| 74 | + # Create Release |
| 75 | + - name: Create Release |
| 76 | + uses: softprops/action-gh-release@v1 |
| 77 | + with: |
| 78 | + files: ${{ github.workspace }}/build/*.pdf |
| 79 | + tag_name: v${{ steps.version.outputs.version }} |
| 80 | + name: Release ${{ steps.version.outputs.version }} |
| 81 | + draft: ${{ github.event.inputs.draft }} |
| 82 | + prerelease: ${{ github.event.inputs.prerelease }} |
| 83 | + env: |
| 84 | + GITHUB_TOKEN: ${{ secrets.GHTOKEN }} |
| 85 | + if: github.event_name == 'workflow_dispatch' |
| 86 | + # This condition ensures this step only runs for workflow_dispatch events. |
0 commit comments