1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Automate releng a bit more (#1006)

This commit is contained in:
Tom Limoncelli
2020-12-26 10:05:46 -05:00
committed by GitHub
parent 18d99fd30f
commit ec60b0afc0
2 changed files with 87 additions and 23 deletions

69
bin/make-release.sh Executable file
View File

@ -0,0 +1,69 @@
#!/bin/bash
echo -e
: "${1:?'Provide the version number as the first arg (v1.2.3, not 1.2.3).'}" ;
NEWVERSION="$1"
if [[ "$NEWVERSION" != v* ]]; then
echo "Version should start with v: v1.2.3, not 1.2.3."
exit 1
fi
git tag -d "$NEWVERSION"
PREVVERSION="$(git tag --list '[vV]*' --sort=v:refname |tail -1)"
echo '=========='
echo '== current version:' "$PREVVERSION"
echo '== new version:' "$NEWVERSION"
git checkout -b release_"$NEWVERSION" || true
sed -i.bak -e 's/Version = ".*"/Version = "'"$NEWVERSION"'"/g' main.go
git commit -m'Release '"$NEWVERSION" main.go
git tag -f "$NEWVERSION"
git push --delete origin "$NEWVERSION"
git push origin tag "$NEWVERSION"
echo ======= Creating: draft-notes.txt
echo >draft-notes.txt '
This release includes many new providers (FILL IN), dozens
of bug fixes, and FILL IN.
Breaking changes:
* FILL IN
Major features:
* FILL IN
Provider-specific changes:
* FILL IN
Other changes and improvements:
* FILL IN
'
git log "$NEWVERSION"..."$PREVVERSION" >>draft-notes.txt
git push --set-upstream origin "release_$NEWVERSION"
echo "NEXT STEP:
1. Create a PR:
open \"https://github.com/StackExchange/dnscontrol/compare/master...release_$NEWVERSION\"
2. Edit draft-notes.txt into actual release notes.
3. Verify tests complete successfully.
4. Merge the PR when satisfied.
5. Promote the release.
"

View File

@ -19,24 +19,18 @@ go version
```
## Step 2. Check unit and integration tests
## Step 2. Create a new release branch
There's a GitHub Actions [workflow](https://github.com/StackExchange/dnscontrol/actions?query=workflow%3Abuild) which builds the code and runs a set of unit and integration tests. Make sure all tests are passing, including the integration tests for all DNS providers.
From the "master" branch, run `bin/bin/make-release.sh v1.2.3` where
"v1.2.3" should be the release version.
This will do a few things.
## Step 3. Bump the version number
Edit the "Version" variable in `pkg/version/version.go` and commit.
```
export PREVVERSION=3.3.0 <<< Change to the previous version
export VERSION=3.4.0 <<< Change to the new release version
git checkout master
vi main.go <<< Change "Version" to new release version
git commit -m'Release v'"$VERSION" main.go
git tag v"$VERSION"
git push origin tag v"$VERSION"
```
1. Tag the current branch locally and remotely.
2. Update main.go with the new version string.
3. Create a file called draft-notes.txt which you will edit into the
release notes.
4. Print instructions on how to create the release PR.
NOTE: If you bump the major version, you need to change all the source
files. The last time this was done (v2 -> v3) these two commands
@ -49,13 +43,11 @@ sed -i.bak -e 's@github.com.StackExchange.dnscontrol.v2@github.com/StackExchange
find * -name \*.bak -delete
```
## Step 4. Write the release notes.
## Step 3. Write the release notes.
The release notes that you write will be used in a few places.
To find items to write about, review the git log using this command:
git log v"$VERSION"...v"$PREVVERSION"
draft-notes.txt is just a draft and needs considerable editing.
Entries in the bullet list should be phrased in the positive: "Feature
FOO now does BAR". This is often the opposite of the related issue,
@ -94,7 +86,7 @@ Provider-specific changes:
* CLOUDFLARE: Fix CF trying to update non-changeable TTL (#issueid)
```
## Step 5. Make the draft release.
## Step 4. Make the draft release.
[On github.com, click on "Draft a new release"](https://github.com/StackExchange/dnscontrol/releases/new)
@ -112,6 +104,9 @@ Fill in the text box with the release notes written above.
(DO use the "preview" tab to proofread the text.)
## Step 5. Merge the release.
Merge the PR into Master.
## Step 6. Publish the release
@ -119,7 +114,7 @@ a. Publish the release.
Make sure the "This is a pre-release" checkbox is UNchecked. Then click "Publish Release".
b. Wait for workflow to complete
b. Wait for workflow to complete
There's a GitHub Actions [workflow](https://github.com/StackExchange/dnscontrol/actions?query=workflow%3Arelease) which automatically builds and attaches
all 3 binaries to the release. Refresh the page after a few minutes and you'll
@ -164,11 +159,11 @@ If you are at Stack Overflow:
# Tip: How to update modules
List out-of-date modules and update any that
List out-of-date modules and update any that
```
go get -u github.com/psampaz/go-mod-outdated
go list -mod=mod -u -m -json all | go-mod-outdated -update -direct
go list -mod=mod -u -m -json all | go-mod-outdated -update -direct
```
To update a module, `get` it, then re-run the unit and integration tests.