Skip to content

Commit

Permalink
ci: throw error on wrong tag instead of skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal committed Dec 12, 2024
1 parent 272c1ad commit a324bc7
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .github/scripts/docker_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 4 additions & 1 deletion .github/workflows/docker-airflow-acryl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:

jobs:
setup:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
Expand All @@ -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: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-airflow-plugin-pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-dagster-plugin-pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-datahub-jars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-gx-plugin-pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit a324bc7

Please sign in to comment.