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

Commit

Permalink
Automate Louketo releases (#615)
Browse files Browse the repository at this point in the history
Fixes #615
  • Loading branch information
Bruno Oliveira da Silva committed Jun 4, 2020
1 parent f623dee commit 9fd264c
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

# Only trigger this action when a new release is published
on:
release:
types: [published]

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
# Setup the workflow to use the specific version of Go
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.13.1'
# Checkout the repository
- name: Checkout
uses: actions/checkout@v2
# Cleans up unreachable Git objects and convert a shallow clone to a regular one if needed
- name: Unshallow
run: git fetch --prune --unshallow
# Run tests prior to release
- name: Test
run: make test
# Publish the binaries
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57 changes: 57 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Mark the release as not ready for production in case there is an
# indicator for this in the tag e.g. v1.0.0-rc1
# See: https://goreleaser.com/customization/release/
release:
prerelease: auto
# Prune any dependencies that are no longer needed before the build starts
before:
hooks:
- go mod tidy
builds:
# Make sure that cgo is disabled. See: https://golang.org/cmd/cgo/
- env:
- CGO_ENABLED=0
# Adds some metadata to the build like version, commit reference and the date of the build
ldflags:
- -w -X "main.build={{.Version}}" -X "main.gitsha={{ .FullCommit }}" -X "main.compiled={{ .Date }}"
- id: macos
goos: [darwin]
goarch: [amd64]

- id: linux
goos: [linux]
goarch: [amd64]

- id: windows
goos: [windows]
goarch: [amd64]
# Generate the checksum for each file
checksum:
name_template: '{{ .ProjectName }}-checksum.txt'
algorithm: sha512
# Generate the changelog to be included into the release notes
changelog:
sort: asc
filters:
# Exclude commit messages matching the regex listed below
exclude:
- "^test:"
- Merge pull request
- Merge branch
# The artifacts to be uploaded
archives:
- id: nix
builds: [macos, linux]
# Generate the compresed files based on the following templates
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
# All files will be in a single directory. For example: louketo_0.0.1_linux_amd64
wrap_in_directory: true
# Replacement for the Platform name. Instead of have -darwin, replace by macOS
replacements:
darwin: macOS
format: tar.gz
- id: windows
builds: [windows]
# All files will be in a single directory. For example: louketo_0.0.1_linux_amd64
wrap_in_directory: true
format: zip
23 changes: 23 additions & 0 deletions docs/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Release process

## Before doing a release

* Make sure that all the issues in the milestones are resolved
* Make sure CI is passing

## Drafting a new release

The release process was automated to release builds based on the Git tag when a new draft release is created.

### Steps

1. Visit https://github.com/louketo/louketo-proxy/releases/new
2. Choose a new tag version based on [Semantic Versioning 2.0.0](https://semver.org/) and pick the target branch.
3. Choose the release title and add a proper description
4. Publish the release

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:

[![Release demo](http://img.youtube.com/vi/OkDd91L6GuQ/0.jpg)](http://www.youtube.com/watch?v=OkDd91L6GuQ "Release demo")


0 comments on commit 9fd264c

Please sign in to comment.