Skip to content

Commit

Permalink
workflows: automate uploads to PyPI (bug 1785066) (#1095)
Browse files Browse the repository at this point in the history
- add new workflow that deploys to TestPyPI and PyPI
- update README with new deploy instructions
  • Loading branch information
zzzeid authored Aug 23, 2022
1 parent 3a7156c commit a57d160
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and upload to TestPyPI and PyPI

on:
release:
types: [published]

jobs:
build-and-publish-to-pypi:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TESTPYPI_TOKEN: ${{ secrets.TESTPYPI_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m venv env
source env/bin/activate
python -m pip install --upgrade pip
python -m pip install wheel twine
python -m pip install -r requirements/requirements-3.10-Linux.txt
python -m pip install -e .
- name: Build
run: |
source env/bin/activate
python setup.py sdist bdist_wheel
ls -alh dist/
- name: Upload to TestPyPI
run: |
source env/bin/activate
python -m twine upload -r testpypi dist/* --verbose --username __token__ --password ${TESTPYPI_TOKEN}
- name: Upload to PyPI
run: |
source env/bin/activate
python -m twine upload dist/* --verbose --username __token__ --password ${PYPI_TOKEN}
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,11 @@ If it turns up errors, try using the `lint-fix.sh` script to fix any errors whic

### Making a release

This is currently a multi-step process:
Create a new GitHub release and give it a tag name identical to the version number you want (e.g. `4.0.20`). CI should automatically upload new versions of the GUI applications to the release and to TestPyPI and PyPI.

1. Create a new GitHub release and give it a tag name identical to the version number you want (e.g. `4.0.20`).
CI should automatically upload new versions of the GUI applications to the release.
2. Fetch the tag locally and make a new release. The recommended workflow is something like this (this assumes you have [twine](https://pypi.org/project/twine/) installed):
Follow the following conventions for pre-releases:

```bash
git fetch origin # assumes origin is mozilla/mozregression
git checkout 4.0.20
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
```
- For development releases, tags should be appended with .devN, starting with N=0. For example, 6.2.1.dev0.
- For alpha, beta, or release candidates, tags should be appended with aN, bN, or rcN, starting with N=0. For example, 6.2.1a0.dev4, 6.2.1rc2, etc...

For more info, see [PEP 440](https://peps.python.org/pep-0440/).

0 comments on commit a57d160

Please sign in to comment.