Skip to content

Commit

Permalink
fixed version bump (#11)
Browse files Browse the repository at this point in the history
* fixed version bump, by checking on cloud that the version in the toml corresponds to the release tag; modified the Makefile accordingly and updated the changelog

* removed the prefix from the tag as its agains semantic versionsing rules and also disturbs the versioning check in the gha workflow
  • Loading branch information
tropxy authored Mar 24, 2022
1 parent 936d395 commit d266f91
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 23 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish Python 🐍 distributions 📦 to Switch PyPI
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
- "[0-9]+.[0-9]+.[0-9]+*"

jobs:
build-n-publish:
Expand All @@ -18,7 +18,6 @@ jobs:
- name: Tries to get the tag version or branch name
id: context
run: |
echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/heads/}
echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/tags/}
- name: Setup the Python Environment by installing Poetry
Expand All @@ -28,8 +27,9 @@ jobs:
shell: bash
run: |
# TAG_VERSION can be also obtained with:
# poetry version $(git describe --tags --abbrev=0)
poetry version $TAG_VERSION
# $(git describe --tags --abbrev=0)
proj_version=$(poetry version -s)
if [ $proj_version != $TAG_VERSION ]; then echo "Version $proj_version, defined in pyproject.toml, does not match TAG $TAG_VERSION of this release"; exit 3; fi
poetry config repo.pypi-switch https://pypi.switch-ev.com/
poetry config http-basic.pypi-switch $PYPI_USER $PYPI_PASS
poetry update
Expand All @@ -38,4 +38,4 @@ jobs:
env:
TAG_VERSION: ${{ steps.context.outputs.TAG_VERSION }}
PYPI_USER: ${{ secrets.PYPI_USER }}
PYPI_PASS: ${{ secrets.PYPI_PASS }}
PYPI_PASS: ${{ secrets.PYPI_PASS }}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Network interface extraction from cs parameters; Update of the code with mqtt version 0.18.1 by @tropxy in https://github.com/SwitchEV/slac/pull/10

### Fixed

- Fix set credentials by @tropxy in https://github.com/SwitchEV/slac/pull/8

## [0.4.0] - 2021-12-20

### Added
Expand Down
34 changes: 19 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# all the recipes are phony (no files to check).
.PHONY: .check-env-vars .deps .pip-install docs tests build dev run update install-local run-local deploy help configure-credentials
.PHONY: .check-env-vars .deps .pip-install docs tests build dev run update install-local run-local deploy help release configure-credentials
.DEFAULT_GOAL := help

IS_LINUX_OS := $(shell uname -s | grep -c Linux)
Expand All @@ -13,21 +13,24 @@ export PATH := ${HOME}/.local/bin:$(PATH)
help:
@echo "Please use 'make <target>' where <target> is one of"
@echo ""
@echo " build builds the app in Docker"
@echo " run runs the app in Docker with prod settings"
@echo " dev runs the app in Docker with dev settings"
@echo " run-local runs the app locally with prod settings"
@echo " run-local-sudo runs the app locally using prod settings and root privileges"
@echo " poetry-update updates the dependencies in poetry.lock"
@echo " install-local installs slac into the current environment"
@echo " set-credentials sets the Switch PyPi credentials directly into pyroject.toml. Use this recipe with caution"
@echo " tests run all the tests"
@echo " reformat reformats the code, using Black"
@echo " flake8 flakes8 the code"
@echo " deploy deploys the project using Poetry (not recommended, only use if really needed)"
@echo " build builds the app in Docker"
@echo " run runs the app in Docker with prod settings"
@echo " dev runs the app in Docker with dev settings"
@echo " run-local runs the app locally with prod settings"
@echo " run-local-sudo runs the app locally using prod settings and root privileges"
@echo " poetry-update updates the dependencies in poetry.lock"
@echo " install-local installs slac into the current environment"
@echo " set-credentials sets the Switch PyPi credentials directly into pyroject.toml. Use this recipe with caution"
@echo " tests run all the tests"
@echo " reformat reformats the code, using Black"
@echo " flake8 flakes8 the code"
@echo " release version=<mj.mn.p> bumps the project version to <mj.mn.p>, using poetry;"
@echo " deploy deploys the project using Poetry (not recommended, only use if really needed)"
@echo ""
@echo "Check the Makefile to know exactly what each target is doing."

.install-poetry:
@if [ -z ${IS_POETRY} ]; then pip install poetry; fi

.check-os:
# The @ is to surpress the output of the evaluation
Expand Down Expand Up @@ -98,8 +101,9 @@ flake8:

code-quality: reformat mypy black flake8

bump-version:
poetry version
release: .install-poetry
@echo "Please remember to update the CHANGELOG.md, before tagging the release"
@poetry version ${version}

deploy: .check-env-vars .deps build bump-version
poetry config repo.pypi-switch https://pypi.switch-ev.com/
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[tool.poetry]
name = "slac"
# This version is a placeholder as the real version is fetched from GitHub
# Tags during releases of the package
version = "0.0.0"
version = "0.4.0"
description = "SLAC Protocol implementation, defined in ISO15118-3"
authors = ["André Duarte <andre@switch-ev.com, andre14x@gmail.com>"]

Expand Down

0 comments on commit d266f91

Please sign in to comment.