matrix-commander/.github/workflows/pypi-publish.yml

38 lines
843 B
YAML

name: PyPi Publish
# on: push
# on: pull_request
# on:
# push:
# branches:
# - master
# Adding "git push origin <tag>" made it trigger the workflow twice.
# Hence made it so that only pushing tags triggers the workflow.
# And only if the tag is a version ending in ".0".
# Minor versions like "v2.40.1" will be skipped.
on:
push:
tags:
- 'v*.0'
workflow_dispatch:
jobs:
publish-pypi:
# Only publish on `main` branch
# if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions: # Don't forget permissions
contents: write
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: pypi-publish
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}