Skip to content

Commit 87bf841

Browse files
authored
Create github action for publishing to pypi (#13)
How to release a new version of `xpystac` to PyPi ## Releasing 1. Update version in source code: https://github.com/jsignell/xpystac/blob/main/xpystac/__init__.py 2. Created and push a tag on `main` branch: ``` git tag -a 0.0.1 -m "Release 0.0.1" git push --tags ``` 3. [Create a new release using the GitHub UI](https://github.com/jsignell/xpystac/releases/new) - the tag should be a version number, like `0.0.1` - choose the target from "recent commits", and select the most recent commit on `main` 4. Once this release is created, a GitHub Actions build will automatically start. That build publishes a release to PyPi. You can access logs for this build on the "Actions" tab in GitHub.
1 parent d4476ea commit 87bf841

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build-n-publish:
10+
name: Build and publish to PyPI
11+
runs-on: ubuntu-18.04
12+
13+
steps:
14+
- name: checkout repo
15+
uses: actions/[email protected]
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v3
19+
with:
20+
python-version: "3.x"
21+
22+
- name: Build a binary wheel and a source tarball
23+
run: |
24+
python -m pip install --upgrade build
25+
python -m build
26+
27+
- name: Publish distribution to PyPI
28+
uses: pypa/gh-action-pypi-publish@release/v1.6.4
29+
with:
30+
# Password is set in GitHub UI to an API secret for pypi
31+
user: __token__
32+
password: ${{ secrets.PYPI_API_KEY }}

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ build-backend = "flit_core.buildapi"
44

55
[project]
66
name = "xpystac"
7-
author = "Julia Signell"
8-
author-email = "[email protected]"
7+
authors = [
8+
{name = "Julia Signell", email = "[email protected]"}
9+
]
910
classifiers = [ "License :: OSI Approved :: MIT License",]
1011
dependencies = [
1112
"xarray",

0 commit comments

Comments
 (0)