-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate release process with GitHub Actions (#118)
* 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
Showing
5 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
@@ -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, | ||
|