Skip to content

Commit

Permalink
Build & attach release assets automatically (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHorstmann authored Nov 1, 2020
1 parent 2792c28 commit 61bf50d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 33 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
release:
types: [published]

name: release
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:

- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.15

- name: Build binaries
run: go run build/build.go

- name: Upload dnscontrol-Darwin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./dnscontrol-Darwin
asset_name: dnscontrol-Darwin
asset_content_type: application/octet-stream

- name: Upload dnscontrol-Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./dnscontrol-Linux
asset_name: dnscontrol-Linux
asset_content_type: application/octet-stream

- name: Upload dnscontrol.exe
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./dnscontrol.exe
asset_name: dnscontrol.exe
asset_content_type: application/octet-stream
40 changes: 7 additions & 33 deletions docs/release-engineering.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,44 +115,18 @@ 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
## Step 6. Publish the release

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?)
a. Publish the release.

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

This is what it looks like when you did it right:

```
$ ./dnscontrol-Darwin version
dnscontrol 3.0.0 ("a7c62e5d317e7e3da76dffd8e24d6a9d304d8159") built 22 Mar 20 15:16 EDT
```

This is what it looks like when there was a file that wasn't checked in:

```
$ ./dnscontrol-Darwin version
dnscontrol 3.0.0 ("ee5208bd5f19b9e5dd0bdba8d0e13403c43a469a[dirty]") built 22 Mar 20 15:16 EDT
^^^^^
^^^^^
^^^^^
```


## 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.
Make sure the "This is a pre-release" checkbox is UNchecked. Then click "Publish Release".

b. Submit the release.
b. Wait for workflow to complete

Make sure the "This is a pre-release" checkbox is UNchecked. Then click "Publish Release".
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
see dnscontrol-Darwin, dnscontrol-Linux, and dnscontrol.exe attached as assets.


## Step 7. Announce it via email
Expand Down

0 comments on commit 61bf50d

Please sign in to comment.