diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ae9c05..b029aeb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,12 @@ on: push: tags: - 'v*' + workflow_dispatch: + inputs: + tag: + description: 'Tag to release (e.g. v0.2.0). Must already exist.' + required: true + type: string permissions: contents: write @@ -18,7 +24,7 @@ jobs: build: name: Build ${{ matrix.platform }} runs-on: ${{ matrix.runner }} - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' strategy: fail-fast: false matrix: @@ -37,6 +43,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v5.0.1 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }} - name: Install Rust uses: dtolnay/rust-toolchain@stable @@ -67,7 +75,7 @@ jobs: docs: name: Build documentation runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' defaults: run: shell: bash @@ -77,6 +85,7 @@ jobs: uses: actions/checkout@v5.0.1 with: fetch-depth: 0 + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }} - name: Set up Python uses: actions/setup-python@v5 @@ -101,7 +110,7 @@ jobs: name: Create Release runs-on: ubuntu-latest needs: build - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true @@ -116,7 +125,7 @@ jobs: - name: Create Release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ github.ref_name }} + tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }} files: tsi-* generate_release_notes: true env: @@ -129,7 +138,7 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: docs - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' steps: - name: Deploy to GitHub Pages id: deployment