-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add workflow for releases (#3018)
GitHub Actions workflow to create a release: will upload to PyPI and create a GitHub release with the `sdist` and `bdist_wheel` as well. The version code is switched to `setuptools_scm` to work well with this flow (e.g. avoid needing to write a script that does a `sed` on the version file and commits as part of release). Signed-off-by: Milas Bowman <milas.bowman@docker.com>
- Loading branch information
Showing
12 changed files
with
96 additions
and
22 deletions.
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 |
---|---|---|
|
@@ -9,3 +9,6 @@ max_line_length = 80 | |
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yaml,yml}] | ||
indent_size = 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
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,44 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "Release Tag WITHOUT `v` Prefix (e.g. 6.0.0)" | ||
required: true | ||
dry-run: | ||
description: 'Dry run' | ||
required: false | ||
type: boolean | ||
default: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- run: python setup.py sdist bdist_wheel | ||
env: | ||
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DOCKER: ${{ inputs.tag }} | ||
|
||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: ! inputs.dry-run | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
- name: Create GitHub release | ||
uses: ncipollo/release-action@v1 | ||
if: ! inputs.dry-run | ||
with: | ||
artifacts: "dist/*" | ||
generateReleaseNotes: true | ||
draft: true | ||
commit: ${{ github.sha }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ inputs.tag }} |
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 |
---|---|---|
|
@@ -13,6 +13,10 @@ html/* | |
_build/ | ||
README.rst | ||
|
||
# setuptools_scm | ||
_version.py | ||
|
||
env/ | ||
venv/ | ||
.idea/ | ||
*.iml |
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
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 |
---|---|---|
@@ -1,2 +1,14 @@ | ||
version = "6.0.0-dev" | ||
version_info = tuple(int(d) for d in version.split("-")[0].split(".")) | ||
try: | ||
from ._version import __version__ | ||
except ImportError: | ||
try: | ||
# importlib.metadata available in Python 3.8+, the fallback (0.0.0) | ||
# is fine because release builds use _version (above) rather than | ||
# this code path, so it only impacts developing w/ 3.7 | ||
from importlib.metadata import version, PackageNotFoundError | ||
try: | ||
__version__ = version('docker') | ||
except PackageNotFoundError: | ||
__version__ = '0.0.0' | ||
except ImportError: | ||
__version__ = '0.0.0' |
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,5 @@ | ||
[build-system] | ||
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] | ||
|
||
[tool.setuptools_scm] | ||
write_to = 'docker/_version.py' |
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