From 092e75cfc481e00b9627198b4fcef11a3891029b Mon Sep 17 00:00:00 2001 From: Rafael Sene Date: Tue, 21 May 2024 17:34:08 -0300 Subject: [PATCH] Update GitHub Actions Signed-off-by: Rafael Sene --- .github/workflows/build-pdf.yml | 132 ++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build-pdf.yml b/.github/workflows/build-pdf.yml index 83a2ccd..f824e48 100644 --- a/.github/workflows/build-pdf.yml +++ b/.github/workflows/build-pdf.yml @@ -1,64 +1,82 @@ -name: Create Specification Document +--- + name: Create Specification Document -# The workflow is triggered by pull request, push to main, and manual dispatch. -on: - workflow_dispatch: - inputs: - 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 + # 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: choice + options: + - Draft + - Release + - Stable + 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 + jobs: + build: + runs-on: ubuntu-latest - steps: - # Step 1: Checkout the repository - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: 'recursive' + steps: + # Checkout the repository + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive - # Step 2: Pull the latest RISC-V Docs container image - - name: Pull Container - run: docker pull riscvintl/riscv-docs-base-container-image:latest + # Pull the latest RISC-V Docs container image + - name: Pull Container + run: docker pull riscvintl/riscv-docs-base-container-image:latest - # Step 3: Build Files - - name: Build Files - run: cd ./specification && make - env: - VERSION: v${{ github.event.inputs.version }} - REVMARK: ${{ github.event.inputs.revision_mark }} + # Override VERSION and REVMARK for manual workflow dispatch + - name: Update environment variables + run: | + echo "VERSION=v${{ github.event.inputs.version }}" >> "$GITHUB_ENV" + echo "REVMARK=${{ github.event.inputs.revision_mark }}" >> "$GITHUB_ENV" + if: github.event_name == 'workflow_dispatch' - # Step 4: Upload the built PDF files as a single artifact - - name: Upload Build Artifacts - uses: actions/upload-artifact@v3 - with: - name: Build Artifacts - path: ${{ github.workspace }}/specification/*.pdf - retention-days: 30 + # Build Files + - name: Build Files + run: make - # Create Release - - name: Create Release - uses: softprops/action-gh-release@v1 - with: - files: ${{ github.workspace }}/specification/*.pdf - tag_name: v${{ github.sha }} - 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. + # Upload the built PDF files as a single artifact + - name: Upload Build Artifacts + uses: actions/upload-artifact@v4 + with: + name: Build Artifacts + path: ${{ github.workspace }}/build/*.pdf + retention-days: 30 + + # Create Release + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + files: ${{ github.workspace }}/build/*.pdf + 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. \ No newline at end of file