Skip to content

Commit

Permalink
ci: fixing semantic versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayvammi committed Apr 17, 2024
1 parent 29d10c4 commit b8034c1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
43 changes: 22 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,18 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: 3.8
- run: python -m pip install python-semantic-release==8.0.7
- run: python -m pip install poetry
- run: |
python -m poetry install --only release
- name: Figure version
continue-on-error: true
id: last_tag
run: |
CURRENT=${python -m poetry run semantic-release --noop version --print-last-released}
echo "Current: $CURRENT"
CURRENT=$(git tag --sort=-committerdate -l | head -n 1)
echo "current: $CURRENT"
VERSION=$(semantic-release --noop --strict version --no-push --no-commit --print)
VERSION=${python -m poetry run semantic-release -vv version --print --tag --push}
echo "New: $VERSION"
if [ "$CURRENT" == "$VERSION" ]; then
Expand All @@ -66,28 +68,27 @@ jobs:
echo "version=$VERSION" >> $GITHUB_OUTPUT
exit 0
- name: Apply new tag
if: steps.last_tag.outcome == 'success'
env:
VERSION: ${{ steps.last_tag.outputs.version }}
uses: actions/github-script@v6
with:
script: |
const {VERSION} = process.env
const tag = `refs/tags/${VERSION}`
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: tag,
sha: context.sha
})
# - name: Apply new tag
# if: steps.last_tag.outcome == 'success'
# env:
# VERSION: ${{ steps.last_tag.outputs.version }}
# uses: actions/github-script@v6
# with:
# script: |
# const {VERSION} = process.env
# const tag = `refs/tags/${VERSION}`
# await github.rest.git.createRef({
# owner: context.repo.owner,
# repo: context.repo.repo,
# ref: tag,
# sha: context.sha
# })
- name: Publish to PyPI
if: steps.last_tag.outcome == 'success'
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
LAST_TAG: ${{ steps.last_tag.outputs.version }}
run: |
python -m pip install poetry
python scripts/update_version.py $LAST_TAG
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ rich = "^13.5.2"
mlflow-skinny = { version = "*", optional = true }
ploomber-engine = "^0.0.31"
dill = "^0.3.8"
python-semantic-release = "^9.4.2"

[tool.poetry.group.docs.dependencies]
mkdocs = "*"
Expand All @@ -50,6 +49,10 @@ scikit-learn = "^1.4.1.post1"
en-core-web-sm = { url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1.tar.gz" }
matplotlib = "^3.8.3"


[tool.poetry.group.release.dependencies]
python-semantic-release = "^9.4.2"

[tool.poetry.extras]
docker = ['docker']
notebook = ['ploomber-engine']
Expand Down Expand Up @@ -192,22 +195,18 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.semantic_release]
tag_commit = false
major_on_zero = true
commit_version_number = false
upload_to_pypi = false
upload_to_repository = false
upload_to_release = false
allow_zero_version = true
# tag_commit = true
major_on_zero = false
# commit_version_number = false
# upload_to_pypi = false
# upload_to_repository = false
# upload_to_release = false
tag_format = "{version}"

[tool.semantic_release.branches.main]
match = "main"

[tool.semantic_release.branches."rc"]
match = "rc"
prerelease = true
prerelease_token = "rc"

[tool.semantic_release.remote]
ignore_token_for_push = true

Expand Down

0 comments on commit b8034c1

Please sign in to comment.