ci: add tests matrix #19
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
# This workflow will upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Upload Python Package | |
on: | |
push: | |
branches: [ main, dev ] | |
workflow_dispatch: | |
jobs: | |
tests: | |
name: π§ͺ Running Tests | |
uses: ./.github/workflows/tests.yml | |
tags: | |
name: π·οΈ Update Tags | |
runs-on: ubuntu-latest | |
needs: tests | |
outputs: | |
new_version: ${{ steps.tag.outputs.new_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
name: ποΈ Checkout | |
- name: β« Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
pre_release_branches: "dev" | |
- name: βοΈ Add tag to output step | |
id: tag | |
run: echo "::set-output name=new_version::${{ steps.tag_version.outputs.new_version }}" | |
deploy: | |
name: π Publish | |
runs-on: ubuntu-latest | |
needs: tags | |
steps: | |
- uses: actions/checkout@v3 | |
name: ποΈ Checkout | |
- name: π Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: βοΈ Install dependencies | |
run: python -m pip install --upgrade pip build twine | |
- name: Bump version | |
run: sed -i 's/__version__ = "0.0.0"/__version__ = "${{ needs.tags.outputs.new_version }}"/g' src/splitter/__init__.py | |
- name: π¨ Build package | |
run: python -m build | |
- name: π Publish Package | |
env: | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: twine upload -u __token__ dist/* |