Improve pages deployment #1660
Workflow file for this run
This file contains hidden or 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: 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' | |
| tag_name: | |
| description: Name of the tag for the release | |
| required: true | |
| release_notes: | |
| description: Release Notes | |
| required: false | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| # 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 | |
| - name: Update environment variables for push events | |
| run: | | |
| echo "EXTRA_ASCIIDOC_OPTIONS=-a github_commit_sha=$GITHUB_SHA" >> "$GITHUB_ENV" | |
| if: github.event_name == 'push' | |
| - name: Detect Release Trigger | |
| id: detect_release | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.create_release }}" = "true" ]; then | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV | |
| echo "RELEASE_TYPE=intermediate" >> $GITHUB_ENV | |
| elif [ "${{ github.event_name }}" = "push" ] && [[ "${{ github.ref }}" =~ ^refs/tags/v[0-9] ]]; then | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| TAG_NAME="${GITHUB_REF#refs/tags/}" | |
| echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV | |
| echo "RELEASE_TYPE=intermediate" >> $GITHUB_ENV | |
| else | |
| echo "should_release=false" >> $GITHUB_OUTPUT | |
| fi | |
| # Build PDF and HTML files using the container | |
| - name: Build Files | |
| id: build_files | |
| run: make -j$(nproc) | |
| # Upload the riscv-cheri PDF file | |
| - name: Upload riscv-cheri.pdf | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-cheri-${{ env.SHORT_SHA }}.pdf | |
| path: ${{ github.workspace }}/build/riscv-cheri.pdf | |
| retention-days: 7 | |
| - name: Upload riscv-cheri.html | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-cheri-${{ env.SHORT_SHA }}.html | |
| path: ${{ github.workspace }}/build/riscv-cheri.html | |
| retention-days: 7 | |
| - name: Upload riscv-cheri.epub | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-cheri-${{ env.SHORT_SHA }}.epub | |
| path: ${{ github.workspace }}/build/riscv-cheri.epub | |
| retention-days: 7 | |
| # Upload the riscv-cheri-full PDF file | |
| - name: Upload riscv-cheri-full.pdf | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-cheri-full-${{ env.SHORT_SHA }}.pdf | |
| path: ${{ github.workspace }}/build/riscv-cheri-full.pdf | |
| retention-days: 7 | |
| - name: Upload riscv-cheri-full.html | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-cheri-full-${{ env.SHORT_SHA }}.html | |
| path: ${{ github.workspace }}/build/riscv-cheri-full.html | |
| retention-days: 7 | |
| - name: Upload riscv-cheri-full.epub | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-cheri-full-${{ env.SHORT_SHA }}.epub | |
| path: ${{ github.workspace }}/build/riscv-cheri-full.epub | |
| retention-days: 7 | |
| # Upload the riscv-privileged PDF file | |
| - name: Upload riscv-privileged.pdf | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-privileged-${{ env.SHORT_SHA }}.pdf | |
| path: ${{ github.workspace }}/build/riscv-privileged.pdf | |
| retention-days: 7 | |
| # Upload the riscv-privileged HTML file | |
| - name: Upload riscv-privileged.html | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-privileged-${{ env.SHORT_SHA }}.html | |
| path: ${{ github.workspace }}/build/riscv-privileged.html | |
| retention-days: 7 | |
| # Upload the riscv-privileged EPUB file | |
| - name: Upload riscv-privileged.epub | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-privileged-${{ env.SHORT_SHA }}.epub | |
| path: ${{ github.workspace }}/build/riscv-privileged.epub | |
| retention-days: 7 | |
| # Upload the riscv-unprivileged PDF file | |
| - name: Upload riscv-unprivileged.pdf | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-unprivileged-${{ env.SHORT_SHA }}.pdf | |
| path: ${{ github.workspace }}/build/riscv-unprivileged.pdf | |
| retention-days: 7 | |
| # Upload the riscv-unprivileged HTML file | |
| - name: Upload riscv-unprivileged.html | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-unprivileged-${{ env.SHORT_SHA }}.html | |
| path: ${{ github.workspace }}/build/riscv-unprivileged.html | |
| retention-days: 7 | |
| # Upload the riscv-unprivileged EPUB file | |
| - name: Upload riscv-unprivileged.epub | |
| if: steps.build_files.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: riscv-unprivileged-${{ env.SHORT_SHA }}.epub | |
| path: ${{ github.workspace }}/build/riscv-unprivileged.epub | |
| retention-days: 7 | |
| # Prepare release assets by adding the version number as a suffix | |
| - name: Prepare Release Assets | |
| if: steps.build_files.outcome == 'success' && steps.detect_release.outputs.should_release == 'true' | |
| run: | | |
| VERSION="${TAG_NAME#v}" | |
| echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV | |
| cd ${{ github.workspace }}/build | |
| for base in riscv-cheri riscv-cheri-full riscv-privileged riscv-unprivileged; do | |
| for ext in pdf html epub; do | |
| cp "${base}.${ext}" "${base}-${VERSION}.${ext}" | |
| done | |
| done | |
| - name: Create Release | |
| if: steps.build_files.outcome == 'success' && steps.detect_release.outputs.should_release == 'true' | |
| #uses: softprops/action-gh-release@v2.2.2 | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| draft: false | |
| tag_name: ${{ env.TAG_NAME }} | |
| name: ${{ env.TAG_NAME }} | |
| body: | | |
| This release was created by: ${{ github.event.sender.login }} | |
| Release Notes: ${{ github.event.inputs.release_notes }} | |
| files: | | |
| ${{ github.workspace }}/build/*-${{ env.RELEASE_VERSION }}.pdf | |
| ${{ github.workspace }}/build/*-${{ env.RELEASE_VERSION }}.html | |
| ${{ github.workspace }}/build/*-${{ env.RELEASE_VERSION }}.epub | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GHTOKEN }} |