Require tagged commits to be on master for package to be published
This commit is contained in:
parent
da5592124e
commit
9d1d925179
14
.github/workflows/publish-to-pypi.yml
vendored
14
.github/workflows/publish-to-pypi.yml
vendored
@ -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
|
||||
|
14
.github/workflows/publish-to-test-pypi.yml
vendored
14
.github/workflows/publish-to-test-pypi.yml
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user