Skip to content

Commit

Permalink
TestPyPI (#32)
Browse files Browse the repository at this point in the history
* initialize testpypi workflow

* only publish specifically tagged versions

* downgrade to python3.8

* skip trying to publish existing versions

* update instructions to account for GH Actions
  • Loading branch information
mvkovatch3 authored Sep 23, 2021
1 parent 372f9bf commit d8f07ee
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 19 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/publish-to-testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish tagged commits to TestPyPI

on:
push:
tags:
- v*.*.*

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip build wheel twine
- name: Build dists
run: |
python -m build .
- name: Test build and wheel
run: |
cd dist && pip install $(ls *.whl) && twine check *
- name: Publish distribution to TestPyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: True
26 changes: 7 additions & 19 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
This is a lightweight guide for testing and publishing a new release.

## Test release on TestPyPI
## Test release on TestPyPI with GitHub Actions

Tag current commit with a new, unused test version name
Assuming test branch is up to date and synced with remote, tag current commit with a new, unused test version name

```
$ git tag -a v0.1.0b8 -m ""
$ git tag -a v0.1.1b2 -m ""
```

Build distribution
Push tags to remote to initialize TestPyPI action

```
$ python -m build
```

Upload using twine

```
$ twine upload --repository testpypi dist/ctdcal-0.1.0b8
```

When prompted:
```
username = __token__
password = TestPyPI API key
$ git push --tags
```

Visit https://test.pypi.org/project/ctdcal/0.1.0b8/ to ensure test release was successful.
Visit https://github.com/cchdo/ctdcal/actions to ensure test release was successful.

## Full release on PyPI with GitHub Actions

Expand All @@ -37,7 +25,7 @@ $ git checkout _hash_
$ git tag -a v0.2.0 -m ""
```

Assuming commit is already pushed, now push tags to remote
Assuming commit is already pushed, now push tags to remote (this will trigger the TestPyPI action above)

```
$ git push --tags
Expand Down

0 comments on commit d8f07ee

Please sign in to comment.