Skip to content

fix(publish): combined release and publishing into a single step (#77) #16

fix(publish): combined release and publishing into a single step (#77)

fix(publish): combined release and publishing into a single step (#77) #16

Workflow file for this run

name: CI
on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
environment: ci
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install pandoc
run: |
sudo apt-get update
sudo apt-get install pandoc
pip install pypandoc
- name: Install npm
run: |
sudo npm install -g npm@latest || sudo npm install -g npm@9
- name: Install dependencies
run: pip install 'tox<4' tox-gh-actions
- name: Run tests
env:
PYTHON_VERSION: ${{ matrix.python-version }}
run: tox
- name: Install release dependencies
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.8'
run: |
pip install bump-my-version build twine
sudo npm install -g semantic-release \
@semantic-release/changelog \
@semantic-release/exec \
@semantic-release/git \
@semantic-release/github
- name: Semantic Release and Publish
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.8'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
npx semantic-release
# If semantic-release was successful, build and publish to PyPI
if [ $? -eq 0 ]; then
python -m build
python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
fi