Skip to content

Commit

Permalink
Automate release process with GitHub Actions (#118)
Browse files Browse the repository at this point in the history
* Automated release workflow

* Commit without change to VERSION

* Change release to master and add prod PyPI

* Release v0.2.2

* Add conditional for primary repo to avoid running on forks

* Create a CONTRIBUTING.md with release instructions
  • Loading branch information
jayqi authored Jul 2, 2020
1 parent b9fc9f6 commit f7f1884
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 1 deletion.
76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: release

on:
push:
branches: [ master ]
paths:
- "VERSION"

jobs:
build:
name: Build and publish new release
runs-on: "ubuntu-latest"
if: github.repository == 'drivendataorg/deon'

steps:

- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Build package
id: build_package
run: |
cat VERSION
echo "::set-output name=version::$(cat VERSION)"
make package
- name: Publish to Test PyPI
uses: pypa/[email protected]
with:
user: ${{ secrets.PYPI_TEST_USERNAME }}
password: ${{ secrets.PYPI_TEST_PASSWORD }}
repository_url: ${{ secrets.PYPI_TEST_REPOSITORY }}
skip_existing: true

- name: Publish to Production PyPI
uses: pypa/[email protected]
with:
user: ${{ secrets.PYPI_PROD_USERNAME }}
password: ${{ secrets.PYPI_PROD_PASSWORD }}
repository_url: ${{ secrets.PYPI_PROD_REPOSITORY }}
skip_existing: false

- name: Tag commit
uses: tvdias/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ steps.build_package.outputs.version }}

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.build_package.outputs.version }}
release_name: v${{ steps.build_package.outputs.version }}
draft: false

- name: Upload tarball to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/deon-${{ steps.build_package.outputs.version }}.tar.gz
asset_name: deon-${{ steps.build_package.outputs.version }}.tar.gz
asset_content_type: application/gzip
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contributing

Contributions are welcome, and they are greatly appreciated!

This document is still a work-in-progress. Sorry!

## Release Process (for maintainers)

The [`release`](https://github.com/drivendataorg/deon/blob/master/.github/workflows/release.yml) GitHub Actions workflow automates the process of releasing a new version of `deon`.

All you need to do kick off the release process is to update the [`VERSION`](https://github.com/drivendataorg/deon/blob/master/VERSION) file and merge the change into the `master` branch. The `release` workflow watches the master branch for changes to this file.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ include LICENSE.txt
include deon/assets/checklist.yml
include deon/assets/examples_of_ethical_issues.yml
include requirements.txt
include VERSION
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2.2
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def load_reqs(path):

long_description = open(Path(__file__).parent / "README.md").read()

with (Path(__file__).parent / "VERSION").open("r") as fp:
version = fp.read().strip()

setup(
name="deon",
Expand All @@ -32,7 +34,7 @@ def load_reqs(path):
"Source Code": "https://github.com/drivendataorg/deon",
"DrivenData": "http://drivendata.co",
},
version="0.2.1",
version=version,
author="DrivenData",
author_email="[email protected]",
include_package_data=True,
Expand Down

0 comments on commit f7f1884

Please sign in to comment.