Require tagged commits to be on master for package to be published

This commit is contained in:
Dominik Moritz Roth 2023-10-29 17:21:13 +01:00
parent da5592124e
commit 9d1d925179
2 changed files with 28 additions and 0 deletions

View File

@ -14,6 +14,20 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # This fetches all history for all branches and tags
- name: Verify tag is on master branch
run: |
TAG_SHA=$(git rev-parse ${{ github.ref }})
MASTER_SHA=$(git rev-parse refs/heads/master)
if [ "$TAG_SHA" == "$MASTER_SHA" ]; then
echo "Tag is on the master branch. Proceeding with the workflow."
else
echo "Tag is not on the master branch. Cancelling the workflow."
exit 1
fi
- name: Set up Python
uses: actions/setup-python@v4

View File

@ -14,6 +14,20 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # This fetches all history for all branches and tags
- name: Verify tag is on master branch
run: |
TAG_SHA=$(git rev-parse ${{ github.ref }})
MASTER_SHA=$(git rev-parse refs/heads/master)
if [ "$TAG_SHA" == "$MASTER_SHA" ]; then
echo "Tag is on the master branch. Proceeding with the workflow."
else
echo "Tag is not on the master branch. Cancelling the workflow."
exit 1
fi
- name: Set up Python
uses: actions/setup-python@v4