diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86926be..13a71b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,12 @@ on: push: tags: - 'v*.*.*' + workflow_dispatch: + inputs: + tag_name: + description: 'Draft release tag (e.g. v0.4.5-test)' + required: true + default: 'v0.0.0-test' name: 🚀 Release on GitHub jobs: @@ -64,11 +70,11 @@ jobs: run: | if [ -f CHANGELOG.md ]; then # Extract version number from tag - VERSION_NUM=$(echo "${{ github.ref_name }}" | sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+)(-.*)?$/\1/') + VERSION_NUM=$(echo "${{ inputs.tag_name || github.ref_name }}" | sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+)(-.*)?$/\1/') # Read and replace placeholders CONTENT=$(cat CHANGELOG.md) - CONTENT=${CONTENT///${{ github.ref_name }}} + CONTENT=${CONTENT///${{ inputs.tag_name || github.ref_name }}} CONTENT=${CONTENT///$VERSION_NUM} echo "content<> $GITHUB_OUTPUT @@ -85,11 +91,11 @@ jobs: run: | if (Test-Path "CHANGELOG.md") { # Extract version number from tag - $version_num = "${{ github.ref_name }}" -replace '^v([0-9]+\.[0-9]+\.[0-9]+)(-.*)?$','$1' + $version_num = "${{ inputs.tag_name || github.ref_name }}" -replace '^v([0-9]+\.[0-9]+\.[0-9]+)(-.*)?$','$1' # Read and replace placeholders $content = Get-Content -Path CHANGELOG.md -Raw - $content = $content -replace '', "${{ github.ref_name }}" + $content = $content -replace '', "${{ inputs.tag_name || github.ref_name }}" $content = $content -replace '', "$version_num" "content<> $env:GITHUB_OUTPUT @@ -106,8 +112,8 @@ jobs: TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} with: - tagName: ${{ github.ref_name }} - releaseName: ${{ github.event.repository.name }}-${{ github.ref_name }} + tagName: ${{ inputs.tag_name || github.ref_name }} + releaseName: ${{ github.event.repository.name }}-${{ inputs.tag_name || github.ref_name }} releaseBody: ${{ (matrix.platform == 'windows-latest' || matrix.platform == 'windows-11-arm') && steps.changelog_windows.outputs.content || steps.changelog_unix.outputs.content }} releaseDraft: true prerelease: false