diff --git a/.github/scripts/docker_helpers.sh b/.github/scripts/docker_helpers.sh index 138c8649820ec5..4125e12d681c31 100755 --- a/.github/scripts/docker_helpers.sh +++ b/.github/scripts/docker_helpers.sh @@ -46,3 +46,11 @@ function get_platforms_based_on_branch { echo "linux/amd64" fi } + +function validate_github_ref_for_python_tag { + if [[ ! "$GITHUB_REF" =~ ^refs/tags/v ]]; then + echo "Error: This workflow must be triggered by a tag starting with 'v'" + echo "Current GITHUB_REF: $GITHUB_REF" + exit 1 + fi +} diff --git a/.github/workflows/docker-airflow-acryl.yml b/.github/workflows/docker-airflow-acryl.yml index bcc4b61fa9cf1b..519c1b16d77c3a 100644 --- a/.github/workflows/docker-airflow-acryl.yml +++ b/.github/workflows/docker-airflow-acryl.yml @@ -7,7 +7,6 @@ on: jobs: setup: - if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest outputs: tag: ${{ steps.tag.outputs.tag }} @@ -16,6 +15,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Validate ref format + run: | + source .github/scripts/docker_helpers.sh + validate_github_ref_for_python_tag - name: Compute Tag id: tag run: | diff --git a/.github/workflows/publish-airflow-plugin-pypi-release.yml b/.github/workflows/publish-airflow-plugin-pypi-release.yml index 84e1a569e246c0..a40a75926f41ce 100644 --- a/.github/workflows/publish-airflow-plugin-pypi-release.yml +++ b/.github/workflows/publish-airflow-plugin-pypi-release.yml @@ -6,13 +6,16 @@ on: jobs: setup: - if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest outputs: tag: ${{ steps.tag.outputs.tag }} steps: - name: Checkout uses: actions/checkout@v4 + - name: Validate ref format + run: | + source .github/scripts/docker_helpers.sh + validate_github_ref_for_python_tag - name: Compute Tag id: tag run: | diff --git a/.github/workflows/publish-dagster-plugin-pypi-release.yml b/.github/workflows/publish-dagster-plugin-pypi-release.yml index 9fcc4279f2bf5c..0b3fbf9771f099 100644 --- a/.github/workflows/publish-dagster-plugin-pypi-release.yml +++ b/.github/workflows/publish-dagster-plugin-pypi-release.yml @@ -6,13 +6,16 @@ on: jobs: setup: - if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest outputs: tag: ${{ steps.tag.outputs.tag }} steps: - name: Checkout uses: actions/checkout@v4 + - name: Validate ref format + run: | + source .github/scripts/docker_helpers.sh + validate_github_ref_for_python_tag - name: Compute Tag id: tag run: | diff --git a/.github/workflows/publish-datahub-jars.yml b/.github/workflows/publish-datahub-jars.yml index eb57c29e151ae6..4d2420450baad5 100644 --- a/.github/workflows/publish-datahub-jars.yml +++ b/.github/workflows/publish-datahub-jars.yml @@ -30,13 +30,16 @@ jobs: echo "Enable publish: ${{ env.SIGNING_KEY != '' }}" echo "publish=${{ env.SIGNING_KEY != '' }}" >> $GITHUB_OUTPUT setup: - if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest outputs: tag: ${{ steps.tag.outputs.tag }} steps: - name: Checkout uses: acryldata/sane-checkout-action@v3 + - name: Validate ref format + run: | + source .github/scripts/docker_helpers.sh + validate_github_ref_for_python_tag - name: Compute Tag id: tag run: | diff --git a/.github/workflows/publish-gx-plugin-pypi-release.yml b/.github/workflows/publish-gx-plugin-pypi-release.yml index 711cfe89dab9a8..8fc96c2ffef1d6 100644 --- a/.github/workflows/publish-gx-plugin-pypi-release.yml +++ b/.github/workflows/publish-gx-plugin-pypi-release.yml @@ -6,13 +6,16 @@ on: jobs: setup: - if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest outputs: tag: ${{ steps.tag.outputs.tag }} steps: - name: Checkout uses: actions/checkout@v4 + - name: Validate ref format + run: | + source .github/scripts/docker_helpers.sh + validate_github_ref_for_python_tag - name: Compute Tag id: tag run: | diff --git a/.github/workflows/publish-pypi-release.yml b/.github/workflows/publish-pypi-release.yml index 7f4b8e948b3752..970915e1c2c1e2 100644 --- a/.github/workflows/publish-pypi-release.yml +++ b/.github/workflows/publish-pypi-release.yml @@ -6,13 +6,16 @@ on: jobs: setup: - if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest outputs: tag: ${{ steps.tag.outputs.tag }} steps: - name: Checkout uses: actions/checkout@v4 + - name: Validate ref format + run: | + source .github/scripts/docker_helpers.sh + validate_github_ref_for_python_tag - name: Compute Tag id: tag run: |