Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up PyPI publishing #60

Merged
merged 4 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish to PyPI
on:
release:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
types: [released]
jobs:
test:
uses: ./.github/workflows/test.yml

build:
needs: ['test']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: 14

- name: Install Node dependencies
run: |
npm ci

- name: Compile JavaScript
run: |
npm run build

- uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install Python dependencies
run: pip install build

- name: Build package distributions
run: python -m build

- uses: actions/upload-artifact@v3
with:
path: ./dist

# https://docs.pypi.org/trusted-publishers/using-a-publisher/
pypi-publish:
needs: ['build']
environment: 'publish'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, the example is without quotes.

https://docs.pypi.org/trusted-publishers/using-a-publisher/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should make no difference, but fun read: https://norwayyaml.com/


name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
# Mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v3

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: artifact/
print-hash: true
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
include LICENSE *.rst *.txt *.md
graft wagtail_ab_testing

prune wagtail_ab_testing.egg-info
prune wagtail_ab_testing/test
prune wagtail_ab_testing/static_src

global-exclude __pycache__
global-exclude *.py[co]
global-exclude *.gitkeep *.gitignore
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down