Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pypi): prevent that PR merged into PR is published to pypi (DEV-3394) #871

Merged
merged 5 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/publish-dev-release-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
name: Publish dev-release to PyPI

on:
pull_request:
types:
- closed
push:
branches:
- main

env:
TOKEN: ${{ secrets.GH_TOKEN }}
Expand All @@ -20,7 +20,7 @@ env:

jobs:
publish-dev-release-to-pypi:
if: github.event.pull_request.merged == true && (startsWith(github.event.pull_request.title, 'fix') || startsWith(github.event.pull_request.title, 'feat'))
if: startsWith(github.event.head_commit.message, 'fix') || startsWith(github.event.head_commit.message, 'feat')
jnussbaum marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- name: Check out repo
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ e2e-tests = "pytest test/e2e/"
bump-version = """
# get current version, append ".postN" (N=no. of commits since last release), write back into pyproject.toml
version=$(git describe --tags --abbrev=0)
commit_cnt=$(git rev-list --count HEAD ^$version)
commit_cnt=$(git rev-list --count main ^$version)
jnussbaum marked this conversation as resolved.
Show resolved Hide resolved
commit_cnt=$((commit_cnt - 1)) # N in ".postN" is zero-based
if [ $commit_cnt -eq -1 ]; then exit 0; fi
new_version=$(poetry version -s).post$commit_cnt # pyproject.toml contains clean numbers, .postN isn't commited
Expand Down