-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from sumup-oss/add-github-action
Add GitHub action
- Loading branch information
Showing
40 changed files
with
301 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
name: Go | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- v* | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
test: | ||
name: Test | ||
strategy: | ||
matrix: | ||
golang: ["1.14"] | ||
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Remove previous jobs | ||
uses: rokroskar/workflow-run-cleanup-action@master | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
# NOTE: Don't stop master or tags jobs since they might be uploading assets and result into a partial release | ||
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && matrix.os == 'ubuntu-latest'" | ||
|
||
- name: Set up Go ${{ matrix.golang }} | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ matrix.golang }} | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download golangci-lint | ||
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.8 | ||
if: "matrix.os == 'ubuntu-latest'" | ||
|
||
- name: Lint | ||
run: $(go env GOPATH)/bin/golangci-lint run --timeout=10m | ||
if: "matrix.os == 'ubuntu-latest'" | ||
|
||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Test (continue on error) | ||
run: go test -v ./... | ||
if: "matrix.os == 'windows-latest'" | ||
continue-on-error: true | ||
|
||
- name: Test (stop on error) | ||
run: go test -v ./... | ||
if: "matrix.os != 'windows-latest'" | ||
continue-on-error: false | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: [test] | ||
if: startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- name: Download gox | ||
run: go get github.com/mitchellh/gox | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get Git tag | ||
id: tag | ||
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build release assets | ||
run: | | ||
$(go env GOPATH)/bin/gox \ | ||
-output='build/vaulted-${{ steps.tag.outputs.TAG }}-{{ .OS }}-{{ .Arch }}' \ | ||
-arch='amd64' \ | ||
-os='linux darwin windows' \ | ||
-verbose \ | ||
-ldflags "-s -w" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
body: Changelog at https://github.com/sumup-oss/vaulted/blob/master/CHANGELOG.md | ||
|
||
# TODO: Replace with glob pattern once `actions/upload-release-asset` supports it | ||
- uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./build/vaulted-${{ steps.tag.outputs.TAG }}-darwin-amd64 | ||
asset_name: vaulted-${{ steps.tag.outputs.TAG }}-darwin-amd64 | ||
asset_content_type: application/octet-stream | ||
|
||
# TODO: Replace with glob pattern once `actions/upload-release-asset` supports it | ||
- uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./build/vaulted-${{ steps.tag.outputs.TAG }}-linux-amd64 | ||
asset_name: vaulted-${{ steps.tag.outputs.TAG }}-linux-amd64 | ||
asset_content_type: application/octet-stream | ||
|
||
# TODO: Replace with glob pattern once `actions/upload-release-asset` supports it | ||
- uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./build/vaulted-${{ steps.tag.outputs.TAG }}-windows-amd64 | ||
asset_name: vaulted-${{ steps.tag.outputs.TAG }}-windows-amd64 | ||
asset_content_type: application/octet-stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.14.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
# Release process | ||
|
||
Travis CI is used as a backbone to get releases going. | ||
GitHub Actions are used as a backbone to get releases going. | ||
|
||
It's currently using a secure Github API OAuth token with `public_repo` | ||
permissions bound to https://github.com/syndbg . | ||
|
||
## Rules | ||
|
||
1. Releases are only created from `master`. | ||
1. `master` is meant to be stable, so before tagging and create a new release, make sure that the CI checks pass. | ||
1. `master` is meant to be stable, so before tagging and pushing a tag, make sure that the CI checks pass. | ||
1. Releases are GitHub releases. | ||
1. Releases are following *semantic versioning*. | ||
1. Releases are to be named in pattern of `vX.Y.Z`. The produced binary artifacts contain the `vX.Y.Z` in their names. | ||
1. Changelog must up-to-date with what's going to be released. Check [CHANGELOG](./CHANGELOG.md). | ||
|
||
## Flow | ||
|
||
1. Create a new GitHub release using https://github.com/sumup-oss/vaulted/releases/new | ||
1. `Tag Version` and `Release Title` are going to be in pattern of `vX.Y.Z`. | ||
1. `Describe this release` (content) is going to link the appropriate [CHANGELOG](./CHANGELOG.md) entry. | ||
1. Wait for Travis CI to pass checks | ||
1. Wait for the produced artifacts to be uploaded at `https://github.com/sumup-oss/vaulted/releases/tag/<vX.Y.Z>` | ||
1. Create a new GitHub a new tag from `master` | ||
1. Push it to the remote git repository. | ||
1. Wait for GitHub action workflow to finish | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.