From b636f8320caf8fe0ea71843cb34eb36c2bdb9a5f Mon Sep 17 00:00:00 2001 From: Divarion-D Date: Sun, 15 Mar 2026 19:21:21 +0300 Subject: [PATCH] chore: enhance workflows to support manual dispatch and dynamic tag resolution --- .github/workflows/build-release.yml | 19 ++++++++++++++++--- .github/workflows/build_pre-release.yml | 17 +++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index ecea690..c85361e 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -3,6 +3,12 @@ name: Build Release Assets on: release: types: [released] + workflow_dispatch: + inputs: + tag_name: + description: 'Release tag (e.g., 1.2.3)' + required: true + type: string permissions: contents: write @@ -12,16 +18,22 @@ jobs: runs-on: ubuntu-latest steps: + - name: Resolve tag name + id: tag + run: | + TAG="${{ github.event.inputs.tag_name || github.event.release.tag_name }}" + echo "name=${TAG}" >> "$GITHUB_OUTPUT" + - name: Checkout code uses: actions/checkout@v5 with: + ref: ${{ steps.tag.outputs.name }} fetch-depth: 0 - name: Determine previous tag id: prev_tag run: | - CURRENT_TAG="${{ github.event.release.tag_name }}" - # Find the tag right before the current one (sorted by version descending) + CURRENT_TAG="${{ steps.tag.outputs.name }}" PREV_TAG=$(git tag --sort=-v:refname | awk -v cur="$CURRENT_TAG" 'found { print; exit } $0 == cur { found=1 }') if [ -z "$PREV_TAG" ]; then echo "No previous tag found — update archives will be skipped" @@ -52,5 +64,6 @@ jobs: - name: Upload assets to release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ github.event.release.tag_name }} + tag_name: ${{ steps.tag.outputs.name }} + files: dist/* files: dist/* diff --git a/.github/workflows/build_pre-release.yml b/.github/workflows/build_pre-release.yml index 2b90af5..1beaed2 100644 --- a/.github/workflows/build_pre-release.yml +++ b/.github/workflows/build_pre-release.yml @@ -3,6 +3,12 @@ name: Build Pre-release Assets on: release: types: [prereleased] + workflow_dispatch: + inputs: + tag_name: + description: 'Pre-release tag (e.g., 1.2.3-beta.1)' + required: true + type: string permissions: contents: write @@ -12,15 +18,22 @@ jobs: runs-on: ubuntu-latest steps: + - name: Resolve tag name + id: tag + run: | + TAG="${{ github.event.inputs.tag_name || github.event.release.tag_name }}" + echo "name=${TAG}" >> "$GITHUB_OUTPUT" + - name: Checkout code uses: actions/checkout@v5 with: + ref: ${{ steps.tag.outputs.name }} fetch-depth: 0 - name: Determine previous tag id: prev_tag run: | - CURRENT_TAG="${{ github.event.release.tag_name }}" + CURRENT_TAG="${{ steps.tag.outputs.name }}" PREV_TAG=$(git tag --sort=-v:refname | awk -v cur="$CURRENT_TAG" 'found { print; exit } $0 == cur { found=1 }') if [ -z "$PREV_TAG" ]; then echo "No previous tag found — update archives will be skipped" @@ -51,5 +64,5 @@ jobs: - name: Upload assets to pre-release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ github.event.release.tag_name }} + tag_name: ${{ steps.tag.outputs.name }} files: dist/*