From e1c0f8662a1b7454f155d2d15594db516c55e421 Mon Sep 17 00:00:00 2001 From: Romain Floreani Date: Wed, 5 Aug 2026 09:25:29 -0400 Subject: [PATCH 1/3] Removing the need for a manual release tag --- .github/workflows/python_deploy_prod.yml | 25 +++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python_deploy_prod.yml b/.github/workflows/python_deploy_prod.yml index 199b32bef9..e1cd88158e 100644 --- a/.github/workflows/python_deploy_prod.yml +++ b/.github/workflows/python_deploy_prod.yml @@ -6,8 +6,8 @@ on: workflow_dispatch: inputs: release-tag: - description: 'Tag for the existing (draft) release to publish assets from' - required: true + description: 'Tag for the release to publish assets from (defaults to the tag this workflow run was triggered from)' + required: false publish-conda: description: 'Publish Conda package' required: false @@ -26,20 +26,35 @@ concurrency: cancel-in-progress: true jobs: + validate-release-tag: + name: Validate release tag + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Ensure a release tag is resolvable + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ] && \ + [ -z "${{ github.event.inputs.release-tag }}" ] && \ + [ "${{ github.ref_type }}" != "tag" ]; then + echo "::error::No 'release-tag' input was provided, and this run was not triggered from a tag (ref_type=${{ github.ref_type }}, ref_name=${{ github.ref_name }}). Re-run this workflow selecting the release tag under 'Use workflow from', or provide 'release-tag' manually." + exit 1 + fi call-workflow-conda-release: name: Publish production Conda package on JFrog Artifactory + needs: validate-release-tag if: ${{ github.event_name == 'release' || github.event.inputs.publish-conda == 'true' }} uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_conda_assets.yml@v3 permissions: contents: write with: virtual-repo-names: '["public-noremote-conda-prod"]' - release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag }} + release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag || github.ref_name }} secrets: JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} call-workflow-pypi-release: name: Publish production PyPI package (JFrog Artifactory, PyPI) + needs: validate-release-tag if: ${{ github.event_name == 'release' || github.event.inputs.publish-pypi == 'true' }} uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_pypi_assets.yml@v3 permissions: @@ -47,8 +62,8 @@ jobs: with: package-name: 'mira-simpeg' virtual-repo-names: '["public-pypi-prod", "pypi"]' - release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag }} + release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag || github.ref_name }} secrets: JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} - PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} \ No newline at end of file From c20adfe6d2f703a95cbbdfa355470180bf9ea29d Mon Sep 17 00:00:00 2001 From: Romain Floreani Date: Mon, 24 Aug 2026 09:35:05 -0400 Subject: [PATCH 2/3] Updating the guard for the python --- .github/workflows/python_deploy_prod.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python_deploy_prod.yml b/.github/workflows/python_deploy_prod.yml index e1cd88158e..55417cc15b 100644 --- a/.github/workflows/python_deploy_prod.yml +++ b/.github/workflows/python_deploy_prod.yml @@ -26,17 +26,23 @@ concurrency: cancel-in-progress: true jobs: + # Fail-fast guard, so it fails here rather than in the downstream jobs. validate-release-tag: name: Validate release tag runs-on: ubuntu-latest timeout-minutes: 5 steps: - name: Ensure a release tag is resolvable + env: + EVENT_NAME: ${{ github.event_name }} + RELEASE_TAG_INPUT: ${{ github.event.inputs.release-tag }} + REF_TYPE: ${{ github.ref_type }} + REF_NAME: ${{ github.ref_name }} run: | - if [ "${{ github.event_name }}" = "workflow_dispatch" ] && \ - [ -z "${{ github.event.inputs.release-tag }}" ] && \ - [ "${{ github.ref_type }}" != "tag" ]; then - echo "::error::No 'release-tag' input was provided, and this run was not triggered from a tag (ref_type=${{ github.ref_type }}, ref_name=${{ github.ref_name }}). Re-run this workflow selecting the release tag under 'Use workflow from', or provide 'release-tag' manually." + if [ "$EVENT_NAME" = "workflow_dispatch" ] && \ + [ -z "$RELEASE_TAG_INPUT" ] && \ + [ "$REF_TYPE" != "tag" ]; then + echo "::error::No 'release-tag' input was provided, and this run was not triggered from a tag (ref_type=$REF_TYPE, ref_name=$REF_NAME). Re-run this workflow selecting the release tag under 'Use workflow from', or provide 'release-tag' manually." exit 1 fi call-workflow-conda-release: From d1c8a0bb167c6e4ff8562d59c093a26145bc77e3 Mon Sep 17 00:00:00 2001 From: Romain Floreani Date: Mon, 24 Aug 2026 16:09:54 -0400 Subject: [PATCH 3/3] Adressing the PR feedback --- .github/workflows/python_deploy_prod.yml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/python_deploy_prod.yml b/.github/workflows/python_deploy_prod.yml index 55417cc15b..20df57d585 100644 --- a/.github/workflows/python_deploy_prod.yml +++ b/.github/workflows/python_deploy_prod.yml @@ -5,9 +5,6 @@ on: types: [published] workflow_dispatch: inputs: - release-tag: - description: 'Tag for the release to publish assets from (defaults to the tag this workflow run was triggered from)' - required: false publish-conda: description: 'Publish Conda package' required: false @@ -22,7 +19,7 @@ on: permissions: {} concurrency: - group: ${{ github.workflow }}-${{ github.event.release.tag_name || github.event.inputs.release-tag || github.run_id }} + group: ${{ github.workflow }}-${{ github.event.release.tag_name || github.ref_name }} cancel-in-progress: true jobs: @@ -32,19 +29,14 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - name: Ensure a release tag is resolvable + - name: Ensure this run was triggered from a tag + if: ${{ github.event_name == 'workflow_dispatch' && github.ref_type != 'tag' }} env: - EVENT_NAME: ${{ github.event_name }} - RELEASE_TAG_INPUT: ${{ github.event.inputs.release-tag }} REF_TYPE: ${{ github.ref_type }} REF_NAME: ${{ github.ref_name }} run: | - if [ "$EVENT_NAME" = "workflow_dispatch" ] && \ - [ -z "$RELEASE_TAG_INPUT" ] && \ - [ "$REF_TYPE" != "tag" ]; then - echo "::error::No 'release-tag' input was provided, and this run was not triggered from a tag (ref_type=$REF_TYPE, ref_name=$REF_NAME). Re-run this workflow selecting the release tag under 'Use workflow from', or provide 'release-tag' manually." - exit 1 - fi + echo "::error::This run was not triggered from a tag (ref_type=$REF_TYPE, ref_name=$REF_NAME). Re-run this workflow selecting the release tag under 'Use workflow from'." + exit 1 call-workflow-conda-release: name: Publish production Conda package on JFrog Artifactory needs: validate-release-tag @@ -54,7 +46,7 @@ jobs: contents: write with: virtual-repo-names: '["public-noremote-conda-prod"]' - release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag || github.ref_name }} + release-tag: ${{ github.event.release.tag_name || github.ref_name }} secrets: JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} @@ -68,7 +60,7 @@ jobs: with: package-name: 'mira-simpeg' virtual-repo-names: '["public-pypi-prod", "pypi"]' - release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag || github.ref_name }} + release-tag: ${{ github.event.release.tag_name || github.ref_name }} secrets: JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}