releasepro 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- releasepro-0.1.0/.gitignore +7 -0
- releasepro-0.1.0/CHANGELOG.md +25 -0
- releasepro-0.1.0/LICENSE +21 -0
- releasepro-0.1.0/PKG-INFO +141 -0
- releasepro-0.1.0/README.md +118 -0
- releasepro-0.1.0/pyproject.toml +48 -0
- releasepro-0.1.0/src/releasepro/VERSION +1 -0
- releasepro-0.1.0/src/releasepro/__init__.py +4 -0
- releasepro-0.1.0/src/releasepro/__main__.py +5 -0
- releasepro-0.1.0/src/releasepro/cli.py +132 -0
- releasepro-0.1.0/src/releasepro/config.py +228 -0
- releasepro-0.1.0/src/releasepro/notes.py +165 -0
- releasepro-0.1.0/src/releasepro/release.py +623 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to releasepro. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
|
+
|
|
6
|
+
## 0.1.0 (2026-10-21)
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- `releasepro run --as LOGIN` starts the release workflow on the release
|
|
11
|
+
branch, approves each gate as it appears once you say yes, and then checks
|
|
12
|
+
that every channel lists the version. It is gitpro's release script, made
|
|
13
|
+
generic and driven by `releasepro.toml`.
|
|
14
|
+
- Run again after it stops (Ctrl-C, a failed job, a gate answered no),
|
|
15
|
+
`releasepro run` follows the run still going on that commit or offers to
|
|
16
|
+
re-run its failed jobs. `--run ID` picks up a given run.
|
|
17
|
+
- `releasepro verify X.Y.Z` checks PyPI, the GitHub release, the MCP
|
|
18
|
+
Registry, the VS Code Marketplace, Open VSX and a site, and waits up to 20
|
|
19
|
+
minutes for the ones that list a version late. `--json` prints the result.
|
|
20
|
+
- `releasepro notes X.Y.Z` writes the release notes and an announcement draft
|
|
21
|
+
from the changelog. `--check` fails when the changelog has no section for
|
|
22
|
+
the version, so a release without notes stops before it starts.
|
|
23
|
+
- The `verify` action runs `releasepro verify` in a workflow.
|
|
24
|
+
- AGENTS.md and a skill tell coding agents how to set up and run a release,
|
|
25
|
+
and what to leave to a person.
|
releasepro-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yantrakar and Sandeep Shelke
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: releasepro
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: One gated GitHub Actions release run for any repo: a person's yes per channel, no stored token, every channel checked, the announcement last
|
|
5
|
+
Project-URL: Homepage, https://github.com/Yantrakar/releasepro
|
|
6
|
+
Project-URL: Issues, https://github.com/Yantrakar/releasepro/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/Yantrakar/releasepro/blob/main/CHANGELOG.md
|
|
8
|
+
Author: Yantrakar
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: changelog,github-actions,mcp-registry,open-vsx,pypi,release,trusted-publishing,vscode-marketplace
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: POSIX
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
18
|
+
Classifier: Topic :: System :: Software Distribution
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Requires-Dist: gitpro<0.5,>=0.4.3
|
|
21
|
+
Requires-Dist: tomli>=1.1; python_version < '3.11'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# releasepro
|
|
25
|
+
|
|
26
|
+
One gated GitHub Actions release run for any repo:
|
|
27
|
+
|
|
28
|
+
- a person says yes at each channel's gate;
|
|
29
|
+
- no token is stored anywhere;
|
|
30
|
+
- every channel is checked until it lists the version;
|
|
31
|
+
- the release notes and an announcement draft come from your changelog.
|
|
32
|
+
|
|
33
|
+
The promise: **a version is announced only once it can be installed from every
|
|
34
|
+
channel, and nothing is published without a person's yes.**
|
|
35
|
+
|
|
36
|
+
releasepro started as the release tool of [gitpro](https://github.com/Yantrakar/gitpro),
|
|
37
|
+
which releases to GitHub, PyPI, the VS Code Marketplace, Open VSX, the MCP Registry
|
|
38
|
+
and its site from one run. The spec is [docs/spec/00-product.md](docs/spec/00-product.md).
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pipx install releasepro
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
It needs Python 3.9 or newer, git, and the GitHub CLI `gh` 2.40 or newer, signed in
|
|
47
|
+
to the account that approves releases.
|
|
48
|
+
|
|
49
|
+
## Use
|
|
50
|
+
|
|
51
|
+
Put a `releasepro.toml` at the root of your repo:
|
|
52
|
+
|
|
53
|
+
```toml
|
|
54
|
+
[release]
|
|
55
|
+
repo = "Owner/name"
|
|
56
|
+
version_file = "src/name/VERSION" # the first word of line 1 is X.Y.Z
|
|
57
|
+
branch = "main"
|
|
58
|
+
workflow = "release.yml" # started with workflow_dispatch
|
|
59
|
+
preflight = ["gitpro why"] # commands that must exit 0 first
|
|
60
|
+
|
|
61
|
+
[channel.github]
|
|
62
|
+
assets = ["name-{v}-py3-none-any.whl", "name-{v}.tar.gz", "SHA256SUMS"]
|
|
63
|
+
|
|
64
|
+
[channel.pypi]
|
|
65
|
+
project = "name"
|
|
66
|
+
|
|
67
|
+
[notes]
|
|
68
|
+
changelog = "CHANGELOG.md"
|
|
69
|
+
summary = "One line about the project, used in the announcement."
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Other channels: `[channel.vscode-marketplace] extension = "publisher.name"`,
|
|
73
|
+
`[channel.openvsx] extension = "namespace/name"`,
|
|
74
|
+
`[channel.mcp-registry] name = "io.github.Owner/name"` and
|
|
75
|
+
`[channel.site] url = "https://…"`, with `names_version` for the text the page holds
|
|
76
|
+
once it is on the new version (`{v}` is the version).
|
|
77
|
+
|
|
78
|
+
Then, on the release branch, with the version file and the changelog updated:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
releasepro notes --check # the changelog has a section for the version
|
|
82
|
+
releasepro run --as LOGIN # start the run, approve each gate, check every channel
|
|
83
|
+
releasepro verify # check again later; changes nothing
|
|
84
|
+
releasepro notes --announcement # the draft post
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`run` asks before it starts the run and at every gate; `--yes` answers yes for you.
|
|
88
|
+
Run it again after it stops (Ctrl-C, a failed job, a gate answered no): it follows the
|
|
89
|
+
run still going on that commit, or offers to re-run the failed jobs. `--run ID` picks
|
|
90
|
+
up a given run. It never switches your global `gh` account; it runs `gh` as `LOGIN`
|
|
91
|
+
through gitpro.
|
|
92
|
+
|
|
93
|
+
Exit codes: 0 done, 1 a check or a job failed, 2 usage or setup error, 130 stopped.
|
|
94
|
+
`verify` and `notes` take `--json`.
|
|
95
|
+
|
|
96
|
+
## Release notes and the announcement
|
|
97
|
+
|
|
98
|
+
From the changelog section for the version (`## 1.2.3` or `## [1.2.3]`, as
|
|
99
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) writes it),
|
|
100
|
+
`releasepro notes --write DIR` writes:
|
|
101
|
+
|
|
102
|
+
- `RELEASE_NOTES.md`: the section as you wrote it, then one line per channel. Use it
|
|
103
|
+
as the GitHub release's body.
|
|
104
|
+
- `ANNOUNCEMENT.md`: a short post of at most 280 characters
|
|
105
|
+
(`[notes] short_limit`) and a long one, built from your `summary`, the first sentence
|
|
106
|
+
of each bullet and the links. Attach it to the release.
|
|
107
|
+
|
|
108
|
+
releasepro adds no claim of its own, and it posts nothing: once every channel lists
|
|
109
|
+
the version, `run` prints the short post for you to post.
|
|
110
|
+
|
|
111
|
+
## Your release workflow
|
|
112
|
+
|
|
113
|
+
Your `release.yml` runs on `workflow_dispatch` on the release branch and has one
|
|
114
|
+
GitHub environment with a required reviewer per channel: `release` for the tag and
|
|
115
|
+
the GitHub release, `pypi`, `marketplace`, `openvsx` and `mcp-registry`. This repo's
|
|
116
|
+
own [release.yml](.github/workflows/release.yml) is a working example with `release`
|
|
117
|
+
and `pypi`. Shared workflows and `releasepro init` come in 0.2.0.
|
|
118
|
+
|
|
119
|
+
## In a workflow: the `verify` action
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
- uses: Yantrakar/releasepro@<full commit sha>
|
|
123
|
+
with:
|
|
124
|
+
version: 1.2.3 # default: the version file
|
|
125
|
+
wait-minutes: 20
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
On a Linux or macOS runner, after `actions/checkout`, it runs `releasepro verify`
|
|
129
|
+
against the `releasepro.toml` in the checkout. It passes once every channel lists the
|
|
130
|
+
version, and fails if one does not by the end of the wait.
|
|
131
|
+
|
|
132
|
+
## For coding agents
|
|
133
|
+
|
|
134
|
+
[AGENTS.md](AGENTS.md) and the skill in [.agents/skills/releasepro](.agents/skills/releasepro/SKILL.md)
|
|
135
|
+
say how to set up and run a release, and what to leave to a person: approving a gate,
|
|
136
|
+
creating an environment, a trusted publisher or a cloud credential, and posting the
|
|
137
|
+
announcement.
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
MIT
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# releasepro
|
|
2
|
+
|
|
3
|
+
One gated GitHub Actions release run for any repo:
|
|
4
|
+
|
|
5
|
+
- a person says yes at each channel's gate;
|
|
6
|
+
- no token is stored anywhere;
|
|
7
|
+
- every channel is checked until it lists the version;
|
|
8
|
+
- the release notes and an announcement draft come from your changelog.
|
|
9
|
+
|
|
10
|
+
The promise: **a version is announced only once it can be installed from every
|
|
11
|
+
channel, and nothing is published without a person's yes.**
|
|
12
|
+
|
|
13
|
+
releasepro started as the release tool of [gitpro](https://github.com/Yantrakar/gitpro),
|
|
14
|
+
which releases to GitHub, PyPI, the VS Code Marketplace, Open VSX, the MCP Registry
|
|
15
|
+
and its site from one run. The spec is [docs/spec/00-product.md](docs/spec/00-product.md).
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pipx install releasepro
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
It needs Python 3.9 or newer, git, and the GitHub CLI `gh` 2.40 or newer, signed in
|
|
24
|
+
to the account that approves releases.
|
|
25
|
+
|
|
26
|
+
## Use
|
|
27
|
+
|
|
28
|
+
Put a `releasepro.toml` at the root of your repo:
|
|
29
|
+
|
|
30
|
+
```toml
|
|
31
|
+
[release]
|
|
32
|
+
repo = "Owner/name"
|
|
33
|
+
version_file = "src/name/VERSION" # the first word of line 1 is X.Y.Z
|
|
34
|
+
branch = "main"
|
|
35
|
+
workflow = "release.yml" # started with workflow_dispatch
|
|
36
|
+
preflight = ["gitpro why"] # commands that must exit 0 first
|
|
37
|
+
|
|
38
|
+
[channel.github]
|
|
39
|
+
assets = ["name-{v}-py3-none-any.whl", "name-{v}.tar.gz", "SHA256SUMS"]
|
|
40
|
+
|
|
41
|
+
[channel.pypi]
|
|
42
|
+
project = "name"
|
|
43
|
+
|
|
44
|
+
[notes]
|
|
45
|
+
changelog = "CHANGELOG.md"
|
|
46
|
+
summary = "One line about the project, used in the announcement."
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Other channels: `[channel.vscode-marketplace] extension = "publisher.name"`,
|
|
50
|
+
`[channel.openvsx] extension = "namespace/name"`,
|
|
51
|
+
`[channel.mcp-registry] name = "io.github.Owner/name"` and
|
|
52
|
+
`[channel.site] url = "https://…"`, with `names_version` for the text the page holds
|
|
53
|
+
once it is on the new version (`{v}` is the version).
|
|
54
|
+
|
|
55
|
+
Then, on the release branch, with the version file and the changelog updated:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
releasepro notes --check # the changelog has a section for the version
|
|
59
|
+
releasepro run --as LOGIN # start the run, approve each gate, check every channel
|
|
60
|
+
releasepro verify # check again later; changes nothing
|
|
61
|
+
releasepro notes --announcement # the draft post
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`run` asks before it starts the run and at every gate; `--yes` answers yes for you.
|
|
65
|
+
Run it again after it stops (Ctrl-C, a failed job, a gate answered no): it follows the
|
|
66
|
+
run still going on that commit, or offers to re-run the failed jobs. `--run ID` picks
|
|
67
|
+
up a given run. It never switches your global `gh` account; it runs `gh` as `LOGIN`
|
|
68
|
+
through gitpro.
|
|
69
|
+
|
|
70
|
+
Exit codes: 0 done, 1 a check or a job failed, 2 usage or setup error, 130 stopped.
|
|
71
|
+
`verify` and `notes` take `--json`.
|
|
72
|
+
|
|
73
|
+
## Release notes and the announcement
|
|
74
|
+
|
|
75
|
+
From the changelog section for the version (`## 1.2.3` or `## [1.2.3]`, as
|
|
76
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) writes it),
|
|
77
|
+
`releasepro notes --write DIR` writes:
|
|
78
|
+
|
|
79
|
+
- `RELEASE_NOTES.md`: the section as you wrote it, then one line per channel. Use it
|
|
80
|
+
as the GitHub release's body.
|
|
81
|
+
- `ANNOUNCEMENT.md`: a short post of at most 280 characters
|
|
82
|
+
(`[notes] short_limit`) and a long one, built from your `summary`, the first sentence
|
|
83
|
+
of each bullet and the links. Attach it to the release.
|
|
84
|
+
|
|
85
|
+
releasepro adds no claim of its own, and it posts nothing: once every channel lists
|
|
86
|
+
the version, `run` prints the short post for you to post.
|
|
87
|
+
|
|
88
|
+
## Your release workflow
|
|
89
|
+
|
|
90
|
+
Your `release.yml` runs on `workflow_dispatch` on the release branch and has one
|
|
91
|
+
GitHub environment with a required reviewer per channel: `release` for the tag and
|
|
92
|
+
the GitHub release, `pypi`, `marketplace`, `openvsx` and `mcp-registry`. This repo's
|
|
93
|
+
own [release.yml](.github/workflows/release.yml) is a working example with `release`
|
|
94
|
+
and `pypi`. Shared workflows and `releasepro init` come in 0.2.0.
|
|
95
|
+
|
|
96
|
+
## In a workflow: the `verify` action
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
- uses: Yantrakar/releasepro@<full commit sha>
|
|
100
|
+
with:
|
|
101
|
+
version: 1.2.3 # default: the version file
|
|
102
|
+
wait-minutes: 20
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
On a Linux or macOS runner, after `actions/checkout`, it runs `releasepro verify`
|
|
106
|
+
against the `releasepro.toml` in the checkout. It passes once every channel lists the
|
|
107
|
+
version, and fails if one does not by the end of the wait.
|
|
108
|
+
|
|
109
|
+
## For coding agents
|
|
110
|
+
|
|
111
|
+
[AGENTS.md](AGENTS.md) and the skill in [.agents/skills/releasepro](.agents/skills/releasepro/SKILL.md)
|
|
112
|
+
say how to set up and run a release, and what to leave to a person: approving a gate,
|
|
113
|
+
creating an environment, a trusted publisher or a cloud credential, and posting the
|
|
114
|
+
announcement.
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
MIT
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "releasepro"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "One gated GitHub Actions release run for any repo: a person's yes per channel, no stored token, every channel checked, the announcement last"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
authors = [{ name = "Yantrakar" }]
|
|
14
|
+
keywords = ["release", "github-actions", "pypi", "trusted-publishing", "vscode-marketplace", "open-vsx", "mcp-registry", "changelog"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Operating System :: POSIX",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Topic :: Software Development :: Build Tools",
|
|
22
|
+
"Topic :: System :: Software Distribution",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"gitpro>=0.4.3,<0.5",
|
|
26
|
+
"tomli>=1.1; python_version < '3.11'",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/Yantrakar/releasepro"
|
|
31
|
+
Issues = "https://github.com/Yantrakar/releasepro/issues"
|
|
32
|
+
Changelog = "https://github.com/Yantrakar/releasepro/blob/main/CHANGELOG.md"
|
|
33
|
+
|
|
34
|
+
[project.scripts]
|
|
35
|
+
releasepro = "releasepro.cli:main"
|
|
36
|
+
|
|
37
|
+
[tool.hatch.version]
|
|
38
|
+
path = "src/releasepro/VERSION"
|
|
39
|
+
pattern = '\A(?P<version>\d+\.\d+\.\d+)'
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["src/releasepro"]
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.sdist]
|
|
45
|
+
include = ["/src/releasepro", "/README.md", "/LICENSE", "/CHANGELOG.md"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.0 2026-10-21 first release: run, verify and notes
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""The releasepro command (spec 00, section 5.4). Exit codes: 0 done, 1 a check or a job failed,
|
|
2
|
+
2 usage or setup error, 130 stopped."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import json
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import List, Optional
|
|
10
|
+
|
|
11
|
+
from . import __version__
|
|
12
|
+
from . import config as _config
|
|
13
|
+
from . import notes as _notes
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _parser() -> argparse.ArgumentParser:
|
|
17
|
+
p = argparse.ArgumentParser(prog="releasepro", description="One gated release run for any repo: every channel "
|
|
18
|
+
"behind a person's yes, no stored token, the announcement last.")
|
|
19
|
+
p.add_argument("--version", action="version", version=f"releasepro {__version__}")
|
|
20
|
+
sub = p.add_subparsers(dest="command", metavar="COMMAND")
|
|
21
|
+
|
|
22
|
+
def common(sp: argparse.ArgumentParser) -> None:
|
|
23
|
+
sp.add_argument("-c", "--config", metavar="PATH", type=Path,
|
|
24
|
+
help="releasepro.toml (default: the nearest one at or above the current folder)")
|
|
25
|
+
|
|
26
|
+
r = sub.add_parser("run", help="start the release run, approve its gates, then verify every channel")
|
|
27
|
+
common(r)
|
|
28
|
+
r.add_argument("--as", dest="login", required=True, metavar="LOGIN",
|
|
29
|
+
help="the GitHub account that starts the run and approves its gates")
|
|
30
|
+
r.add_argument("--yes", action="store_true", help="answer yes to every question")
|
|
31
|
+
r.add_argument("--run", type=int, metavar="ID", help="follow an existing release run instead of starting one "
|
|
32
|
+
"(without it, an unfinished run on HEAD is offered first)")
|
|
33
|
+
|
|
34
|
+
v = sub.add_parser("verify", help="check that every channel lists a version; changes nothing")
|
|
35
|
+
common(v)
|
|
36
|
+
v.add_argument("version", nargs="?", metavar="X.Y.Z", help="default: the version in the version file")
|
|
37
|
+
v.add_argument("--as", dest="login", metavar="LOGIN",
|
|
38
|
+
help="read the GitHub release as this gh account (default: gh as it is set up)")
|
|
39
|
+
v.add_argument("--wait", type=float, default=None, metavar="MINUTES",
|
|
40
|
+
help="how long to wait for the channels that list a version late (default: 20)")
|
|
41
|
+
v.add_argument("--json", action="store_true", help="print the result as JSON")
|
|
42
|
+
|
|
43
|
+
ver = sub.add_parser("version", help="print the release version, X.Y.Z, from the version file")
|
|
44
|
+
common(ver)
|
|
45
|
+
|
|
46
|
+
n = sub.add_parser("notes", help="the release notes and the announcement draft, from the changelog")
|
|
47
|
+
common(n)
|
|
48
|
+
n.add_argument("version", nargs="?", metavar="X.Y.Z", help="default: the version in the version file")
|
|
49
|
+
g = n.add_mutually_exclusive_group()
|
|
50
|
+
g.add_argument("--check", action="store_true", help="only check that the changelog has the version's section")
|
|
51
|
+
g.add_argument("--write", type=Path, metavar="DIR", help="write RELEASE_NOTES.md and ANNOUNCEMENT.md into DIR")
|
|
52
|
+
g.add_argument("--announcement", action="store_true", help="print the announcement draft, not the notes")
|
|
53
|
+
n.add_argument("--json", action="store_true", help="print the notes and both drafts as JSON")
|
|
54
|
+
return p
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _load(path: Optional[Path]) -> _config.Config:
|
|
58
|
+
return _config.load(path if path is not None else _config.find(Path.cwd()))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _version(cfg: _config.Config, given: Optional[str]) -> str:
|
|
62
|
+
if given is None:
|
|
63
|
+
return _config.version(cfg)
|
|
64
|
+
if not _config.VERSION_RE.fullmatch(given):
|
|
65
|
+
raise _config.SetupError(f"version {given!r} is not X.Y.Z")
|
|
66
|
+
return given
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _verify(cfg: _config.Config, args: argparse.Namespace) -> int:
|
|
70
|
+
from . import release
|
|
71
|
+
v = _version(cfg, args.version)
|
|
72
|
+
acc = None
|
|
73
|
+
if args.login:
|
|
74
|
+
from gitpro import forge
|
|
75
|
+
acc = forge.Account(forge.GITHUB, "gh", args.login)
|
|
76
|
+
wait = release.LATE_WAIT if args.wait is None else max(0.0, args.wait) * 60
|
|
77
|
+
release.TO_STDERR = args.json
|
|
78
|
+
try:
|
|
79
|
+
results = release.checks(cfg, acc, v, openvsx=True, wait=wait)
|
|
80
|
+
finally:
|
|
81
|
+
release.TO_STDERR = False
|
|
82
|
+
if args.json:
|
|
83
|
+
print(json.dumps({"version": v, "ok": all(g is not False for _, g in results),
|
|
84
|
+
"checks": [{"check": t, "ok": g} for t, g in results]}, indent=2))
|
|
85
|
+
return 0 if all(g is not False for _, g in results) else 1
|
|
86
|
+
return 0 if release.show(results) else 1
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _notes_cmd(cfg: _config.Config, args: argparse.Namespace) -> int:
|
|
90
|
+
v = _version(cfg, args.version)
|
|
91
|
+
if args.check:
|
|
92
|
+
_notes.section(cfg, v)
|
|
93
|
+
print(f"✓ {cfg.notes.changelog} has a section for {v}")
|
|
94
|
+
return 0
|
|
95
|
+
if args.write is not None:
|
|
96
|
+
for path in _notes.write(cfg, v, args.write):
|
|
97
|
+
print(f"✓ wrote {path}")
|
|
98
|
+
return 0
|
|
99
|
+
if args.json:
|
|
100
|
+
print(json.dumps({"version": v, "release_notes": _notes.release_notes(cfg, v),
|
|
101
|
+
"short": _notes.short_text(cfg, v), "long": _notes.long_text(cfg, v)}, indent=2))
|
|
102
|
+
return 0
|
|
103
|
+
print(_notes.announcement(cfg, v) if args.announcement else _notes.release_notes(cfg, v), end="")
|
|
104
|
+
return 0
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def main(argv: Optional[List[str]] = None) -> int:
|
|
108
|
+
p = _parser()
|
|
109
|
+
args = p.parse_args(argv)
|
|
110
|
+
if args.command is None:
|
|
111
|
+
p.print_help()
|
|
112
|
+
return 2
|
|
113
|
+
try:
|
|
114
|
+
cfg = _load(args.config)
|
|
115
|
+
if args.command == "run":
|
|
116
|
+
from . import release
|
|
117
|
+
return release.run(cfg, args.login, args.yes, args.run)
|
|
118
|
+
if args.command == "verify":
|
|
119
|
+
return _verify(cfg, args)
|
|
120
|
+
if args.command == "version":
|
|
121
|
+
print(_config.version(cfg))
|
|
122
|
+
return 0
|
|
123
|
+
return _notes_cmd(cfg, args)
|
|
124
|
+
except _config.SetupError as e:
|
|
125
|
+
print(f"releasepro: {e}", file=sys.stderr)
|
|
126
|
+
return 2
|
|
127
|
+
except _notes.NotesError as e:
|
|
128
|
+
print(f"releasepro: {e}", file=sys.stderr)
|
|
129
|
+
return 1
|
|
130
|
+
except KeyboardInterrupt:
|
|
131
|
+
print("\nStopped.", file=sys.stderr)
|
|
132
|
+
return 130
|