Skip to content

Commit

Permalink
Github action to publish this project (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmuesch committed Nov 6, 2020
1 parent 979ca32 commit 77da76b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 16 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build

on:
pull_request:
release:
types:
- published

jobs:
build_and_publish_wheel:
name: Build and publish wheel
runs-on: ubuntu-20.04
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v2
# Include all history and tags, needed for building the right version
with:
fetch-depth: 0

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'

- name: Install datadog_checks_dev
run: |
python -m pip install datadog_checks_dev[cli]
- name: Set ddev pypi credentials
run: |
ddev config set pypi.user __token__
ddev config set pypi.pass ${{ secrets.PYPI_TOKEN }}
- name: Publish the wheel to PyPI
run: |
ddev release upload .
22 changes: 6 additions & 16 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ This project does not have a strict release schedule. However, we would make a r
- No release will be done if no changes got merged to the `master` branch during the above mentioned window.
- Releases may be done more frequently than the above mentioned window.

## Make Sure Everything Works

* Make sure tests are passing.
* Make sure Docker builds are passing.
* Make sure documentation is up-to-date and building correctly.
* Build the package locally (e.g. `python3 setup.py sdist`), install it into a fresh virtualenv and try playing around with it for a bit.
- Use the manual testing guide.

## Update Changelog

### Prerequisite
Expand All @@ -27,19 +19,17 @@ This project does not have a strict release schedule. However, we would make a r
- See changes ready for release by running `ddev release show changes . --tag-prefix v` at the root of this project. Add any missing labels to PRs if needed.
- Run `ddev release changelog . <NEW_VERSION> -o docs/changelog.md` to update the changelog.
- Commit the changes to the repository in a release branch and get it approved/merged.
- Tag the repository with the new version number.
* Make sure CI is passing. This is the commit that will be released!
* Make sure the most recent Docker [builds](https://hub.docker.com/r/datadog/apigentools/builds) are passing.
* Make sure recent documentation [builds](https://readthedocs.org/projects/apigentools/builds/) are succeeding.

## Release

Note that once the release process is started, nobody should be merging/pushing anything.
We don't want to trigger multiple rebuilds of docs and Docker images with that official final release version and different content - this would only create confusion.

* Pull the merged PR locally and tag the latest commit: `git tag -a "vX.Y.Z" -m "Version X.Y.Z"`
* Create the release on GitHub using the format: `"vX.Y.Z"`
* Note that the `v` in `-a "vX.Y.Z"` is important, our Dockerhub setup recognizes a tag like this and automatically builds image `datadog/apigentools:X.Y.X` from it
* Push the tag with `git push --tags`
* Do a release on PyPI. Since this is a simple non-binary-extension package, we can do source releases only:
* Clean old builds `python setup.py clean`
* Run `python3 setup.py sdist`
* Run `twine upload dist/apigentools-X.Y.Z.tar.gz` - note that we're using [twine](https://github.com/pypa/twine/) to upload to PyPI because it's more secure than plain `python3 setup.py upload`
* A github action will kick off that builds and publishes this tag to PyPI. Confirm the release is [available](https://pypi.org/project/apigentools/#history)
* Go to [readthedocs dashboard](https://readthedocs.org/projects/apigentools/versions/) and add the newly released `X.Y.Z` version to "Active Versions"
* The Dockerhub builds for tagged version are automated, so just make sure that everything went ok
* The Dockerhub builds for tagged version are automated, so just make sure the [build succeeded](https://hub.docker.com/r/datadog/apigentools/builds)

0 comments on commit 77da76b

Please sign in to comment.