From 77da76bd8342df0de82588d8c24ac2a0830773d5 Mon Sep 17 00:00:00 2001 From: Nicholas Muesch Date: Fri, 6 Nov 2020 09:51:55 -0500 Subject: [PATCH] Github action to publish this project (#209) --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++++++++ RELEASING.md | 22 ++++++--------------- 2 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c55fae5 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 . diff --git a/RELEASING.md b/RELEASING.md index 39f8205..d1d65e0 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -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 @@ -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 . -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)