diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..290bc51 --- /dev/null +++ b/.github/workflows/release.yml @@ -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/gh-action-pypi-publish@v1.3.0 + 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/gh-action-pypi-publish@v1.3.0 + 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/github-tagger@v0.0.1 + 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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..42dccb0 --- /dev/null +++ b/CONTRIBUTING.md @@ -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. diff --git a/MANIFEST.in b/MANIFEST.in index 6db915e..ea37a95 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..ee1372d --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.2.2 diff --git a/setup.py b/setup.py index 7b9029c..96370c9 100644 --- a/setup.py +++ b/setup.py @@ -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="info@drivendata.org", include_package_data=True,