Skip to content

Commit

Permalink
Add GH Action to publish to PyPI on new release
Browse files Browse the repository at this point in the history
  • Loading branch information
zerolab committed Oct 7, 2022
1 parent 4cbc0ec commit f150606
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
schedule:
- cron: "28 20 * * 5"

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
analyze:
name: Analyze
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish to PyPI

on:
release:
types: [released, prereleased]

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel
- name: Build
run: python setup.py sdist bdist_wheel

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: '__token__'
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
lint:
Expand Down

0 comments on commit f150606

Please sign in to comment.