Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Commit ebed649

Browse files
Publish to PyPI when releases are created on Github (#75)
* Publish to PyPI when releases are created on Github * Update readme
1 parent 7a1ac22 commit ebed649

File tree

4 files changed

+41
-7
lines changed

4 files changed

+41
-7
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
env:
8+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
9+
10+
jobs:
11+
test:
12+
name: Publish to PyPI
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: 3.8
21+
- name: Install test dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install poetry==1.1.3
25+
- name: Install Dependencies
26+
run: poetry install
27+
- name: Publish to PyPI
28+
run: |
29+
poetry config pypi-token.pypi ${{ PYPI_TOKEN }}
30+
bash scripts/publish.sh

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,3 @@ lint:
1313

1414
test:
1515
tox
16-
17-
release: clean-build
18-
poetry publish --build

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ To run lint, use
2323
make lint
2424

2525
## Release Updated Version
26-
First, make sure you have been added as a collaborator [here](https://pypi.org/manage/project/python-elemental/collaboration/).
27-
Manually increase the version [here](https://github.com/cbsinteractive/elemental/blob/master/pyproject.toml#L3) and run
28-
29-
make release
26+
Use the Github UI to [create a new release](https://github.com/cbsinteractive/elemental/releases/new), the tag needs
27+
to follow the semver format `0.0.0`. After the new release is created, a Github workflow will build and publish the
28+
new python package to PyPI automatically.

scripts/publish.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
version=$(git describe --tags --abbrev=0)
7+
poetry version "${version}"
8+
poetry publish --build

0 commit comments

Comments
 (0)