Skip to content
This repository was archived by the owner on Dec 7, 2020. It is now read-only.

Commit 9fd264c

Browse files
author
Bruno Oliveira da Silva
committed
Automate Louketo releases (#615)
Fixes #615
1 parent f623dee commit 9fd264c

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
3+
# Only trigger this action when a new release is published
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
# Setup the workflow to use the specific version of Go
13+
- name: Set up Go
14+
uses: actions/setup-go@v2
15+
with:
16+
go-version: '^1.13.1'
17+
# Checkout the repository
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
# Cleans up unreachable Git objects and convert a shallow clone to a regular one if needed
21+
- name: Unshallow
22+
run: git fetch --prune --unshallow
23+
# Run tests prior to release
24+
- name: Test
25+
run: make test
26+
# Publish the binaries
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v2
29+
with:
30+
version: latest
31+
args: release --rm-dist
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Mark the release as not ready for production in case there is an
2+
# indicator for this in the tag e.g. v1.0.0-rc1
3+
# See: https://goreleaser.com/customization/release/
4+
release:
5+
prerelease: auto
6+
# Prune any dependencies that are no longer needed before the build starts
7+
before:
8+
hooks:
9+
- go mod tidy
10+
builds:
11+
# Make sure that cgo is disabled. See: https://golang.org/cmd/cgo/
12+
- env:
13+
- CGO_ENABLED=0
14+
# Adds some metadata to the build like version, commit reference and the date of the build
15+
ldflags:
16+
- -w -X "main.build={{.Version}}" -X "main.gitsha={{ .FullCommit }}" -X "main.compiled={{ .Date }}"
17+
- id: macos
18+
goos: [darwin]
19+
goarch: [amd64]
20+
21+
- id: linux
22+
goos: [linux]
23+
goarch: [amd64]
24+
25+
- id: windows
26+
goos: [windows]
27+
goarch: [amd64]
28+
# Generate the checksum for each file
29+
checksum:
30+
name_template: '{{ .ProjectName }}-checksum.txt'
31+
algorithm: sha512
32+
# Generate the changelog to be included into the release notes
33+
changelog:
34+
sort: asc
35+
filters:
36+
# Exclude commit messages matching the regex listed below
37+
exclude:
38+
- "^test:"
39+
- Merge pull request
40+
- Merge branch
41+
# The artifacts to be uploaded
42+
archives:
43+
- id: nix
44+
builds: [macos, linux]
45+
# Generate the compresed files based on the following templates
46+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
47+
# All files will be in a single directory. For example: louketo_0.0.1_linux_amd64
48+
wrap_in_directory: true
49+
# Replacement for the Platform name. Instead of have -darwin, replace by macOS
50+
replacements:
51+
darwin: macOS
52+
format: tar.gz
53+
- id: windows
54+
builds: [windows]
55+
# All files will be in a single directory. For example: louketo_0.0.1_linux_amd64
56+
wrap_in_directory: true
57+
format: zip

docs/release.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Release process
2+
3+
## Before doing a release
4+
5+
* Make sure that all the issues in the milestones are resolved
6+
* Make sure CI is passing
7+
8+
## Drafting a new release
9+
10+
The release process was automated to release builds based on the Git tag when a new draft release is created.
11+
12+
### Steps
13+
14+
1. Visit https://github.com/louketo/louketo-proxy/releases/new
15+
2. Choose a new tag version based on [Semantic Versioning 2.0.0](https://semver.org/) and pick the target branch.
16+
3. Choose the release title and add a proper description
17+
4. Publish the release
18+
19+
The release process should be triggered by GitHub actions and once it's finished, all the binaries should be available in the release page. See the video below:
20+
21+
[![Release demo](http://img.youtube.com/vi/OkDd91L6GuQ/0.jpg)](http://www.youtube.com/watch?v=OkDd91L6GuQ "Release demo")
22+
23+

0 commit comments

Comments
 (0)