pass-thru os.stdin to most calls to allow for gcloud to prompt for re… #11
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
name: main | |
on: [push, pull_request] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.15.x] | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
if: github.event_name == 'push' && !contains(toJson(github.event.commits), '[ci skip]') && !contains(toJson(github.event.commits), '[skip ci]') | |
steps: | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v1 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: install golangci-lint | |
run: | | |
mkdir -p "$HOME/bin" | |
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b "$HOME/bin" | |
echo "$HOME/bin" >> $GITHUB_PATH | |
shell: bash # force windows to use git-bash for access to curl | |
- name: install goreleaser | |
# only need to lint goreleaser on one platform: | |
if: startsWith(runner.os, 'Linux') | |
run: curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b /usr/local/bin | |
- run: make lint | |
shell: bash | |
- run: make test | |
shell: bash | |
release-test: | |
needs: [test] | |
# don't waste time running a goreleaser test build on master since we will run a full release: | |
if: github.ref != 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
- uses: actions/cache@v1 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: install goreleaser | |
run: curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b /usr/local/bin | |
- run: make snapshot | |
release: | |
needs: [test] | |
# only create a release on master builds: | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
- uses: actions/cache@v1 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Unshallow | |
run: | | |
# fetch all tags and history so that goreleaser can generate a proper changelog | |
# and autotag can calculate the next version tag: | |
git fetch --tags --unshallow --prune | |
if [ $(git rev-parse --abbrev-ref HEAD) != "master" ]; then | |
# ensure a local 'master' branch exists for autotag to work correctly: | |
git branch --track master origin/master | |
fi | |
- name: install goreleaser | |
run: curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b /usr/local/bin | |
- name: run autotag to increment version | |
run: | | |
curl -sL https://git.io/autotag-install | sudo sh -s -- -b /usr/local/bin | |
autotag | |
- name: build and push release artifacts | |
env: | |
GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }} | |
run: | | |
make deps | |
make release |