From ed746a4b00c4ccad6c095d597ab74c3b202bb67d Mon Sep 17 00:00:00 2001 From: Romain Floreani Date: Wed, 26 Aug 2026 13:47:27 -0400 Subject: [PATCH 1/2] DEVOPS-1131: Use ref_name and validate release tag in prod deploy --- .github/workflows/python_deploy_prod.yml | 25 ++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python_deploy_prod.yml b/.github/workflows/python_deploy_prod.yml index ee30cb9a..cf45e58f 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 existing (draft) release to publish assets from' - required: true publish-conda: description: 'Publish Conda package' required: false @@ -22,12 +19,27 @@ 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: + # 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 this run was triggered from a tag + if: ${{ github.event_name == 'workflow_dispatch' && github.ref_type != 'tag' }} + env: + REF_TYPE: ${{ github.ref_type }} + REF_NAME: ${{ github.ref_name }} + run: | + 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 if: | github.repository == 'MiraGeoscience/gempy_engine' && (github.event_name == 'release' || github.event.inputs.publish-conda == 'true') @@ -37,12 +49,13 @@ jobs: contents: write with: virtual-repo-names: '["gempy-noremote-conda-prod"]' - release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag }} + 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 }} call-workflow-pypi-release: name: Publish production PyPI package (JFrog Artifactory) + needs: validate-release-tag if: | github.repository == 'MiraGeoscience/gempy_engine' && (github.event_name == 'release' || github.event.inputs.publish-pypi == 'true') @@ -53,7 +66,7 @@ jobs: with: package-name: 'gempy-engine' virtual-repo-names: '["gempy-pypi-prod"]' - release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag }} + 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 }} From f7af229aa65af50d90cf48c767c40f1902c7f172 Mon Sep 17 00:00:00 2001 From: Romain Floreani Date: Tue, 1 Sep 2026 11:35:17 -0400 Subject: [PATCH 2/2] DEVOPS-1131: Simplify release-tag validation for release-triggered runs Skip the v* tag check for the release event, since the upstream draft-release flow already enforces it, and drop the unreachable else branch since the workflow only triggers on release and workflow_dispatch. --- .github/workflows/python_deploy_prod.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python_deploy_prod.yml b/.github/workflows/python_deploy_prod.yml index cf45e58f..564a413f 100644 --- a/.github/workflows/python_deploy_prod.yml +++ b/.github/workflows/python_deploy_prod.yml @@ -29,14 +29,26 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - name: Ensure this run was triggered from a tag - if: ${{ github.event_name == 'workflow_dispatch' && github.ref_type != 'tag' }} + - name: Ensure this run was triggered from a valid release tag env: + EVENT_NAME: ${{ github.event_name }} + RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} REF_TYPE: ${{ github.ref_type }} REF_NAME: ${{ github.ref_name }} run: | - 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 + if [ "$EVENT_NAME" = "release" ]; then + echo "::notice::Triggered by published release '$RELEASE_TAG_NAME'." + elif [ "$EVENT_NAME" = "workflow_dispatch" ]; then + if [ "$REF_TYPE" != "tag" ]; then + 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 + fi + if [[ "$REF_NAME" != v* ]]; then + echo "::error::Tag '$REF_NAME' does not look like a release tag (release tags must start with 'v'). Re-run this workflow selecting a valid release tag." + exit 1 + fi + echo "::notice::Release tag '$REF_NAME' validated successfully." + fi call-workflow-conda-release: name: Publish production Conda package on JFrog Artifactory needs: validate-release-tag