Skip to content

Commit 8342b9a

Browse files
authored
Merge pull request openwallet-foundation#4226 from swcurran/main
2 parents 6d459a3 + 19e2e71 commit 8342b9a

2 files changed

Lines changed: 66 additions & 76 deletions

File tree

‎PUBLISHING.md‎

Lines changed: 37 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# How to Publish a New Version
22

3-
The code to be published should be in the `main` branch. Make sure that all the PRs to go in the release are
4-
merged, and decide on the release tag. Should it be a release candidate or the final tag, and should it be
5-
a major, minor or patch release, per [semver](https://semver.org/) rules.
3+
The code to be published should be at the HEAD of the `main` branch or of an LTS
4+
branch. Make sure that all the PRs to go in the release are merged, and decide
5+
on the release tag. Should it be a release candidate or the final tag, and
6+
should it be a major, minor or patch release, per [semver](https://semver.org/)
7+
rules?
68

7-
Once ready to do a release, create a local branch that includes the following updates:
9+
Once ready to do a release, follow these steps:
810

9-
1. Create a local PR branch from an updated `main` branch, e.g. "1.7.0".
11+
1. Create a local PR branch from an updated `main` or LTS branch, e.g. `git checkout -b 1.7.0`.
12+
- For a main branch release update your local `main` branch with the latest changes from the upstream `main` branch before creating the new release branch - e.g. `git fetch upstream;git merge upstream/main main`
13+
- For an LTS release, you have to check out the latest LTS branch locally. For example, run `git fetch upstream; git checkout 1.3.lts; git merge upstream/1.3.lts --ff-only` for the appropriate LTS branch.
1014

1115
2. See if there are any Document Site `mkdocs` changes needed. Run the script
1216
`./scripts/prepmkdocs.sh; mkdocs`. Watch the log, noting particularly if
@@ -17,71 +21,42 @@ Once ready to do a release, create a local branch that includes the following up
1721
sure to do the last `clean` step -- **DO NOT MERGE THE TEMPORARY DOC
1822
CHANGES.** For more details see the [Managing the ACA-Py Documentation Site] document.
1923

20-
3. Update the CHANGELOG.md to add the new release. Only create a new section
24+
2. Update the CHANGELOG.md to add the new release. Only create a new section
2125
when working on the first release candidate for a new release. When
2226
transitioning from one release candidate to the next, or to an official
2327
release, just update the title and date of the change log section.
2428

25-
4. Collect the details of the merged PRs included in this release -- a list of
29+
3. Collect the details of the merged PRs included in this release -- a list of
2630
PR title, number, link to PR, author's github ID, and a link to the author's
2731
github account. Do not include `dependabot` PRs. For those, we put a live
2832
link for the date range of the release (guidance below).
2933

30-
To generate the list, run the `./scripts/genChangeLog.sh` scripts (requires you
31-
have [gh] and [jq] installed), with the date of the day before the last
32-
release. The day before is picked to make sure you get all of the changes.
33-
The script generates the list of all PRs, minus the dependabot ones, merged since
34-
the last release in the required markdown format for the ChangeLog. At the end
35-
of the list is some markdown for putting a link into the ChangeLog to see the
36-
dependabot PRs merged in the release.
34+
To generate the list, run `./scripts/genChangeLog.sh YYYY-MM-DD [<branch>]`
35+
(requires you have [gh] and [jq] installed), with the date the day before the
36+
last release. The day before is picked to make sure you pick up all of the
37+
changes. The script generates the list of all PRs merged since the date
38+
(minus, for a `main` branch runs, dependabot PRs) in the required markdown
39+
format for the ChangeLog entry. At the end of the list is some markdown for
40+
putting a link into a `main` branch release for the ChangeLog to see the
41+
dependabot PRs merged in the release. Assuming you are creating a Release PR,
42+
the last line of the output is the number of the PR you will be creating
43+
(unless someone gets another one in before you do).
3744

3845
**Note**: The output of the script is _roughly_ what you need for the
3946
ChangeLog, but use your discretion in getting the list right, and making
40-
sure the dates for the dependabot PRs is correct. For example, when doing a
47+
sure the dates for the dependabot PRs link is correct. For example, when doing a
4148
follow up to an RC release, the date range in the dependabot link should
4249
be the day before the last non-RC release, which won't be generated correctly
43-
in this release.
50+
for the non-RC release.
4451

4552
[gh]: https://github.com/cli/cli
4653
[jq]: https://jqlang.github.io/jq/download/
4754

48-
From the root of the repository folder, run:
55+
Once you have the list of PRs follow the format of past ChangeLog entries to create a complete entry for the release. After an RC entry has been created, updated it for the next RC or final release -- don't add new entries for the same release. An AI can be used to help generate the ChangeLog entry, but it is important to review the output and make sure it is correct and complete.
4956

50-
```bash
51-
./scripts/genChangeLog.sh <date> [<branch>]
52-
```
53-
54-
Leave off the arguments to get usage information. Date format is `YYYY-MM-DD`, and the branch defaults to `main` if not specified. The date should be the day before the last release, so that you get all of the PRs merged since the last release.
55-
56-
The output should look like this -- which matches what is needed in [CHANGELOG.md](CHANGELOG.md):
57-
58-
```text
59-
60-
- Only change interop testing fork on pull requests [\#3218](https://github.com/openwallet-foundation/acapy/pull/3218) [jamshale](https://github.com/jamshale)
61-
- Remove the RC from the versions table [\#3213](https://github.com/openwallet-foundation/acapy/pull/3213) [swcurran](https://github.com/swcurran)
62-
- Feature multikey management [\#3246](https://github.com/openwallet-foundation/acapy/pull/3246) [PatStLouis](https://github.com/PatStLouis)
63-
64-
```
65-
66-
Once you have the list of PRs:
67-
68-
- ChatGPT or equivalent can be used to process the list of PRs and:
69-
- Organize the list into suitable categories in the [CHANGELOG.md](CHANGELOG.md) file, update (if necessary) the PR title and add notes to clarify the changes. See previous release entries to understand the style -- a format that should help developers.
70-
- Add a narrative about the release above the PR that highlights what has gone into the release.
71-
- To cover the `dependabot` PRs without listing them all, add to the end of the
72-
categorized list of PRs the two `dependabot` lines of the script output (after the list of PRs). The text will look like this:
73-
74-
```text
75-
- Dependabot PRs
76-
- [List of Dependabot PRs in this release](https://github.com/openwallet-foundation/acapy/pulls?q=is%3Apr+is%3Amerged+merged%3A2024-08-16..2024-09-16+author%3Aapp%2Fdependabot+)
77-
```
78-
79-
- Check the dates in the `dependabot` URL to make sure the full period between the previous non-RC release to the date of the non-RC release you are preparing.
80-
- Include a PR in the list for this soon-to-be PR, initially with the "next to be issued" number for PRs/Issues. At the end output of the script is the highest numbered PR and issue. Your PR will be one higher than the highest of those two numbers. Note that you still might have to correct the number after you create the PR if someone sneaks an issue or PR in before you submit your PR.
81-
82-
5. Check to see if there are any other PRs that should be included in the release.
57+
4. Check to see if there are any other PRs that should be included in the release.
8358

84-
6. Update the ReadTheDocs in the `/docs` folder by following the instructions in
59+
5. Update the ReadTheDocs in the `/docs` folder by following the instructions in
8560
the `docs/UpdateRTD.md` file. That will likely add a number of new and modified
8661
files to the PR. Eliminate all of the errors in the generation process,
8762
either by mocking external dependencies or by fixing ACA-Py code. If
@@ -94,15 +69,15 @@ cd docs; rm -rf generated; sphinx-apidoc -f -M -o ./generated ../acapy_agent/ $
9469
cd docs; sphinx-build -b html -a -E -c ./ ./ ./_build; cd ..
9570
```
9671

97-
Sphinx can be run with docker -- at least the first step. Here is the command to use:
72+
Sphinx can be run with docker -- at least the first step. Here is the command to use:
9873

9974
```sh
10075
cd docs; cp -r ../docker_agent .; rm -rf generated; docker run -it --rm -v .:/docs sphinxdoc/sphinx sphinx-apidoc -f -M -o ./generated ./acapy_agent/ $(find ./acapy_agent/ -name '*tests*'); rm -rf docker_agent; cd ..
10176
```
10277

103-
For the build test, the RTD Sphinx theme needs to be added to the docker image, and I've not figured out that yet.
78+
For the build test, the RTD Sphinx theme needs to be added to the docker image, and I've not figured out that yet.
10479

105-
7. Search across the repository for the previous version number and update it
80+
6. Search across the repository for the previous version number and update it
10681
everywhere that makes sense. The CHANGELOG.md entry for the previous release
10782
is a likely exception, and the `pyproject.toml` in the root **MUST** be
10883
updated. You can skip (although it won't hurt) to update the files in the
@@ -115,7 +90,7 @@ For the build test, the RTD Sphinx theme needs to be added to the docker image,
11590
have dropped the previously used `-` in the release candidate version string
11691
to better follow the semver rules.
11792

118-
8. Regenerate openapi.json and swagger.json by running
93+
7. Regenerate openapi.json and swagger.json by running
11994
`scripts/generate-open-api-spec` from within the `acapy_agent` folder.
12095

12196
Command: `cd acapy_agent;../scripts/generate-open-api-spec;cd ..`
@@ -124,29 +99,29 @@ For the build test, the RTD Sphinx theme needs to be added to the docker image,
12499
likely with `sudo` -- `rm -rf open-api/.build`. The folder is `.gitignore`d,
125100
so there is not a danger they will be pushed, even if they are not deleted.
126101

127-
9. Double check all of these steps above, and then submit a PR from the branch.
102+
8. Double check all of these steps above, and then submit a PR from the branch.
128103
Add this new PR to CHANGELOG.md so that all the PRs are included.
129104
If there are still further changes to be merged, mark the PR as "Draft",
130105
repeat **ALL** of the steps again, and then mark this PR as ready and then
131106
wait until it is merged. It's embarrassing when you have to do a whole new
132107
release just because you missed something silly...I know!
133108

134-
10. Immediately after the PR is merged and if the release is a final release AND
109+
9. Immediately after the PR is merged and if the release is a final release AND
135110
the latest release AND an LTS release, update the LTS branch to point to
136111
`main`. Do this ONLY when the current release version is both the latest
137112
release AND its version has been declared an LTS release. Once a new version
138113
has been created that has NOT been declared an LTS, the LTS branch will
139114
extend independent of main.
140115

141-
11. Immediately after the PR is merged, create a new GitHub tag representing the
116+
10. Immediately after the PR is merged, create a new GitHub tag representing the
142117
version. The tag name and title of the release should be the same as the
143118
version in
144119
[pyproject.toml](https://github.com/openwallet-foundation/acapy/tree/main/pyproject.toml).
145120
Use the "Generate Release Notes" capability to get a sequential listing of
146121
the PRs in the release, to complement the manually curated Changelog. Verify
147122
on PyPi that the version is published.
148123

149-
12. New images for the release are automatically published by the GitHubAction
124+
11. New images for the release are automatically published by the GitHubAction
150125
Workflow: [publish.yml]. The action is triggered when a release is tagged, so
151126
no manual action is needed. Images are published in the [OpenWallet
152127
Foundation Package Repository under
@@ -188,7 +163,7 @@ For the build test, the RTD Sphinx theme needs to be added to the docker image,
188163

189164
[publish.yml]: https://github.com/openwallet-foundation/acapy/blob/main/.github/workflows/publish.yml
190165

191-
13. When a new release is tagged, create a new branch at the same commit with
166+
12. When a new release is tagged, create a new branch at the same commit with
192167
the branch name in the format `docs-v<version>`, for example, `docs-v1.7.0`.
193168
The creation of the branch triggers the execution of the [publish-docs]
194169
GitHub Action which generates the documentation for the new release,
@@ -202,15 +177,15 @@ For the build test, the RTD Sphinx theme needs to be added to the docker image,
202177
[Managing the ACA-Py Documentation Site]: Managing-ACA-Py-Doc-Site.md
203178
[https://aca-py.org]: https://aca-py.org
204179

205-
14. Perform local testing of an RC release using [ACA-Py
180+
13. Perform local testing of an RC release using [ACA-Py
206181
Plugins](https://github.com/openwallet-foundation/acapy-plugins). Once a
207182
Release Candidate (RC) has been published, a script in the [ACA-Py
208183
Plugins](https://github.com/openwallet-foundation/acapy-plugins) repo
209184
`test_acapy_version.py` can be run locally to test the release artifacts with all
210185
of the plugins. See the documentation about this in the [ACA-Py Plugins
211186
README](https://github.com/openwallet-foundation/acapy-plugins/blob/main/README.md#testing-an-aca-py-release-candidate)
212187

213-
15. Update the [ACA-Py Read The Docs site] by logging into Read The Docs
188+
14. Update the [ACA-Py Read The Docs site] by logging into Read The Docs
214189
administration site, building a new "latest" (main branch) and activating
215190
and building the new release by version ID. Appropriate permissions are
216191
required to publish the new documentation version.

‎scripts/genChangeLog.sh‎

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,35 @@ else
2525
BRANCH=$2
2626
fi
2727

28+
SED_ARGS=(
29+
-e "s/\\\t/ /g"
30+
-e "s/\"//g"
31+
-e "s/WwW /\[\\\#/"
32+
-e "s# XxX #\\](https://github.com/openwallet-foundation/acapy/pull/#"
33+
-e "s/ YyY /) \\[/"
34+
-e "s# ZzZ #\\](https://github.com/#"
35+
-e "s/$/)/"
36+
)
37+
if [ "${BRANCH}" == "main" ]; then
38+
SED_ARGS+=(-e "/app.dependabot/d")
39+
fi
40+
2841
gh pr list -S "merged:>${1}" -L 1000 -B ${BRANCH} --state merged --json number,title,author | \
2942
jq ' .[] | [" -",.title,"WwW",.number,"XxX",.number,"YyY",.author.login,"ZzZ",.author.login] | @tsv' | \
30-
sed -e "s/\\\t/ /g" \
31-
-e "s/\"//g" \
32-
-e "s/WwW /\[\\\#/" \
33-
-e "s# XxX #\\](https://github.com/openwallet-foundation/acapy/pull/#" \
34-
-e "s/ YyY /) \\[/" \
35-
-e "s# ZzZ #\\](https://github.com/#" \
36-
-e "s/$/)/" \
37-
-e "/app.dependabot/d"
38-
now=$(date +%Y-%m-%d)
39-
echo ""
40-
echo "- Dependabot PRs"
41-
echo " - [Link to list of Dependabot PRs in this release](https://github.com/openwallet-foundation/acapy/pulls?q=is%3Apr+is%3Amerged+merged%3A${1}..${now}+author%3Aapp%2Fdependabot+)"
43+
sed "${SED_ARGS[@]}"
44+
45+
if [ "${BRANCH}" == "main" ]; then
46+
now=$(date +%Y-%m-%d)
47+
echo ""
48+
echo "- Dependabot PRs"
49+
echo " - [Link to list of Dependabot PRs in this release](https://github.com/openwallet-foundation/acapy/pulls?q=is%3Apr+is%3Amerged+merged%3A${1}..${now}+author%3Aapp%2Fdependabot+)"
50+
echo ""
51+
fi
52+
echo "Here are the latest issue and pull request numbers:"
53+
LATEST_ISSUE=$(gh issue list -s all -L 1 --json number --jq '.[0].number')
54+
LATEST_PR=$(gh pr list -s all -L 1 --json number --jq '.[0].number')
55+
echo " - Latest issue: #${LATEST_ISSUE}"
56+
echo " - Latest PR: #${LATEST_PR}"
57+
NEXT_PR=$(( (LATEST_ISSUE > LATEST_PR ? LATEST_ISSUE : LATEST_PR) + 1 ))
4258
echo ""
43-
echo Here are the latest issues and pull requests. The release PR you are preparing should be one higher than the highest of the numbers listed:
44-
gh issue list -s all -L 1; gh pr ls -s all -L 1
59+
echo "Use #${NEXT_PR} as the number for the release PR you are preparing."

0 commit comments

Comments
 (0)