CI: Fix version extraction #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main | |
on: push | |
env: | |
LC_ALL: C.UTF-8 | |
LANG: C.UTF-8 | |
jobs: | |
lint: | |
name: Code Quality | |
runs-on: ubuntu-latest | |
container: | |
image: colibris/tox:latest | |
steps: | |
- name: Source code checkout | |
uses: actions/checkout@master | |
- name: Run flake8 | |
run: flake8 colibris | |
test: | |
name: Test | |
needs: lint | |
runs-on: ubuntu-latest | |
container: | |
image: colibris/tox:latest | |
steps: | |
- name: Source code checkout | |
uses: actions/checkout@master | |
- name: Update source version | |
run: sed -i "s/unknown/0.0.0/" colibris/__init__.py | |
- name: Run tox | |
run: tox --workdir=/tmp/tox --recreate | |
release: | |
name: Release | |
if: startsWith(github.ref, 'refs/tags/version-') | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
container: | |
image: colibris/tox:latest | |
steps: | |
- name: Source code checkout | |
uses: actions/checkout@master | |
- name: Extract version from tag | |
id: tagName | |
uses: little-core-labs/get-git-tag@v3.0.2 | |
with: | |
tagRegex: "version-(.*)" | |
- name: Update source version | |
run: sed -i "s/unknown/${GIT_TAG_NAME}/" colibris/__init__.py | |
- name: Python package setup | |
run: python setup.py sdist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |