diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..34d92e4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +--- +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem +version: 2 +updates: + - package-ecosystem: gitsubmodule + directory: / + schedule: + interval: daily diff --git a/.github/workflows/build-doc.yml b/.github/workflows/build-doc.yml deleted file mode 100644 index 9cb6cbb..0000000 --- a/.github/workflows/build-doc.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Create Document - -on: - pull_request: - push: - branches: - - main - release: - types: - - created - -# Cancel any older workflow runs for PRs that are still in progress, so -# pushing quickly several times does not create too much load. -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || format('run-{0}', github.run_id) }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4.2.2 - with: - submodules: recursive - - name: Run build - run: make docker-pull-latest build - env: - VERSION: v${{ github.event.inputs.version }} - REVMARK: ${{ github.event.inputs.revision_mark }} - - name: Upload artifacts - uses: actions/upload-artifact@v4.4.3 - with: - name: riscv-asm-manual.zip - path: | - build/riscv-asm.pdf - build/riscv-asm.html - - release-draft: - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - needs: build - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v4.1.8 - - name: Get timestamp - id: date - run: echo "RELEASE_DATE=$(date --utc +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT - - name: Create draft release - uses: softprops/action-gh-release@v2.1.0 - with: - draft: true - name: Draft release ${{ steps.date.outputs.RELEASE_DATE }} - body: Snapshot (${{ github.sha }}) - files: | - riscv-asm-manual.zip/riscv-asm.pdf - riscv-asm-manual.zip/riscv-asm.html - - release: - if: (github.event_name == 'release' && github.event.action == 'created') - needs: build - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v4.1.8 - - name: Upload assets - uses: softprops/action-gh-release@v2.1.0 - with: - files: | - riscv-asm-manual.zip/riscv-asm.pdf - riscv-asm-manual.zip/riscv-asm.html diff --git a/.github/workflows/build-pdf.yml b/.github/workflows/build-pdf.yml new file mode 100644 index 0000000..309fd24 --- /dev/null +++ b/.github/workflows/build-pdf.yml @@ -0,0 +1,86 @@ +--- +name: Create Specification Document + +# The workflow is triggered by pull request, push to main, and manual dispatch. +on: + workflow_dispatch: + inputs: + revision_mark: + description: 'Set revision mark as Draft, Release or Stable:' + required: true + type: choice + options: + - Development + - Stable + - Frozen + - Ratified + default: Development + 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: + # Checkout the repository + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Get next version + uses: reecetech/version-increment@2024.4.4 + id: version + with: + scheme: semver + increment: patch + + # Pull the latest RISC-V Docs container image + - name: Pull Container + run: docker pull riscvintl/riscv-docs-base-container-image:latest + + # Override VERSION and REVMARK for manual workflow dispatch + - name: Update environment variables + run: | + echo "VERSION=v${{ steps.version.outputs.version }}" >> "$GITHUB_ENV" + echo "REVMARK=${{ github.event.inputs.revision_mark }}" >> "$GITHUB_ENV" + if: github.event_name == 'workflow_dispatch' + + # Build Files + - name: Build Files + run: make + + # 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@v1 + with: + files: ${{ github.workspace }}/build/*.pdf + tag_name: v${{ steps.version.outputs.version }} + name: Release ${{ steps.version.outputs.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. diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..74b9ec3 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,15 @@ +--- +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.0