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

Commit

Permalink
Publish to PyPI when releases are created on Github (#75)
Browse files Browse the repository at this point in the history
* Publish to PyPI when releases are created on Github

* Update readme
  • Loading branch information
rafaelcaricio authored Nov 5, 2020
1 parent 7a1ac22 commit ebed649
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
release:
types: [ created ]

env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

jobs:
test:
name: Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install poetry==1.1.3
- name: Install Dependencies
run: poetry install
- name: Publish to PyPI
run: |
poetry config pypi-token.pypi ${{ PYPI_TOKEN }}
bash scripts/publish.sh
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ lint:

test:
tox

release: clean-build
poetry publish --build
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ To run lint, use
make lint

## Release Updated Version
First, make sure you have been added as a collaborator [here](https://pypi.org/manage/project/python-elemental/collaboration/).
Manually increase the version [here](https://github.com/cbsinteractive/elemental/blob/master/pyproject.toml#L3) and run

make release
Use the Github UI to [create a new release](https://github.com/cbsinteractive/elemental/releases/new), the tag needs
to follow the semver format `0.0.0`. After the new release is created, a Github workflow will build and publish the
new python package to PyPI automatically.
8 changes: 8 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e
set -x

version=$(git describe --tags --abbrev=0)
poetry version "${version}"
poetry publish --build

0 comments on commit ebed649

Please sign in to comment.