Skip to content

Commit

Permalink
Require tagged commits to be on master for package to be published
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Roth committed Oct 29, 2023
1 parent da55921 commit 9d1d925
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9d1d925

Please sign in to comment.