Skip to content

Commit 61bf50d

Browse files
authored
Build & attach release assets automatically (#789)
1 parent 2792c28 commit 61bf50d

File tree

2 files changed

+66
-33
lines changed

2 files changed

+66
-33
lines changed

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
on:
2+
release:
3+
types: [published]
4+
5+
name: release
6+
jobs:
7+
release:
8+
name: release
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Get release
13+
id: get_release
14+
uses: bruceadams/get-release@v1.2.2
15+
env:
16+
GITHUB_TOKEN: ${{ github.token }}
17+
18+
- name: Checkout repo
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v2
25+
with:
26+
go-version: ^1.15
27+
28+
- name: Build binaries
29+
run: go run build/build.go
30+
31+
- name: Upload dnscontrol-Darwin
32+
uses: actions/upload-release-asset@v1
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
upload_url: ${{ steps.get_release.outputs.upload_url }}
37+
asset_path: ./dnscontrol-Darwin
38+
asset_name: dnscontrol-Darwin
39+
asset_content_type: application/octet-stream
40+
41+
- name: Upload dnscontrol-Linux
42+
uses: actions/upload-release-asset@v1
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
with:
46+
upload_url: ${{ steps.get_release.outputs.upload_url }}
47+
asset_path: ./dnscontrol-Linux
48+
asset_name: dnscontrol-Linux
49+
asset_content_type: application/octet-stream
50+
51+
- name: Upload dnscontrol.exe
52+
uses: actions/upload-release-asset@v1
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
with:
56+
upload_url: ${{ steps.get_release.outputs.upload_url }}
57+
asset_path: ./dnscontrol.exe
58+
asset_name: dnscontrol.exe
59+
asset_content_type: application/octet-stream

docs/release-engineering.md

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -115,44 +115,18 @@ Fill in the text box with the release notes written above.
115115

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

118-
Create the binaries and attach them to the release:
119118

120-
go run build/build.go
119+
## Step 6. Publish the release
121120

122-
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?)
121+
a. Publish the release.
123122

124-
WARNING: if there are files that haven't been checked in, the version string will have "dirty" appended.
125-
126-
This is what it looks like when you did it right:
127-
128-
```
129-
$ ./dnscontrol-Darwin version
130-
dnscontrol 3.0.0 ("a7c62e5d317e7e3da76dffd8e24d6a9d304d8159") built 22 Mar 20 15:16 EDT
131-
```
132-
133-
This is what it looks like when there was a file that wasn't checked in:
134-
135-
```
136-
$ ./dnscontrol-Darwin version
137-
dnscontrol 3.0.0 ("ee5208bd5f19b9e5dd0bdba8d0e13403c43a469a[dirty]") built 22 Mar 20 15:16 EDT
138-
^^^^^
139-
^^^^^
140-
^^^^^
141-
```
142-
143-
144-
## Step 6. Attach the binaries and release.
145-
146-
a. Drag and drop binaries into the web form.
147-
148-
There is a box labeled "Attach binaries by dropping them here or
149-
selecting them". Drag dnscontrol-Darwin, dnscontrol-Linux, and
150-
dnscontrol.exe onto that box (one at a time or all at once). This
151-
will upload the binaries.
123+
Make sure the "This is a pre-release" checkbox is UNchecked. Then click "Publish Release".
152124

153-
b. Submit the release.
125+
b. Wait for workflow to complete
154126

155-
Make sure the "This is a pre-release" checkbox is UNchecked. Then click "Publish Release".
127+
There's a GitHub Actions [workflow](https://github.com/StackExchange/dnscontrol/actions?query=workflow%3Arelease) which automatically builds and attaches
128+
all 3 binaries to the release. Refresh the page after a few minutes and you'll
129+
see dnscontrol-Darwin, dnscontrol-Linux, and dnscontrol.exe attached as assets.
156130

157131

158132
## Step 7. Announce it via email

0 commit comments

Comments
 (0)