From 8ac200496f1b1ecc1e19b1cb6e5e05aae8a41e75 Mon Sep 17 00:00:00 2001 From: ngoan1608 Date: Fri, 28 Mar 2025 10:45:39 +0700 Subject: [PATCH 1/2] allow to trigger 'Publish JsonPreprocessor to PyPI' workflow manually --- .github/workflows/python-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 6307095a..a7b79968 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -5,6 +5,7 @@ on: tags: - "rel/*.*.*" - "rel/*.*.*.*" + workflow_dispatch: jobs: build-n-publish: From 8d1365e2aebe8e4578a46ac08d3426ff947632a8 Mon Sep 17 00:00:00 2001 From: ngoan1608 Date: Fri, 28 Mar 2025 11:16:38 +0700 Subject: [PATCH 2/2] add workflow inputs 'tag_name' for creating GitHub Release when triggering manually --- .github/workflows/python-publish.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index a7b79968..f166f341 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -6,6 +6,11 @@ on: - "rel/*.*.*" - "rel/*.*.*.*" workflow_dispatch: + inputs: + tag_name: + description: 'Release Tag name for creating Github Release' + required: false + type: string jobs: build-n-publish: @@ -44,10 +49,29 @@ jobs: password: ${{ secrets.PYPI_API_TOKEN }} # This token should be created in Settings > Secrets > Actions # repository_url: https://test.pypi.org/legacy/ # Use this for testing to upload the distribution to test.pypi + - name: Determine tag + id: tag + run: | + TAG_NAME="" + if [[ "${{ github.event.inputs.tag_name }}" != "" ]]; then + TAG_NAME="${{ github.event.inputs.tag_name }}" + elif [[ "${{ github.ref }}" == refs/tags/* ]]; then + TAG_NAME="${GITHUB_REF#refs/tags/}" + fi + + if [[ -z "$TAG_NAME" ]]; then + echo "No valid tag provided. Skipping release." + exit 0 + else + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV + fi + - name: Create/Update GitHub Release id: create_update_release + if: env.TAG_NAME != '' uses: ncipollo/release-action@v1 with: + tag: ${{ env.TAG_NAME }} allowUpdates: true omitNameDuringUpdate: true makeLatest: true