Skip to content

Merge pull request #2 from joemiller/gha-fix-workflow-trigger #26

Merge pull request #2 from joemiller/gha-fix-workflow-trigger

Merge pull request #2 from joemiller/gha-fix-workflow-trigger #26

Workflow file for this run

name: main
on:
push:
tags-ignore:
- '*'
branches:
- '**'
# TODO: break this up into separate workflows for a more idiomatic GHA setup. anything that is doing "if branch" is a candidate
jobs:
test:
runs-on: ubuntu-latest
if: github.event_name == 'push' && !contains(toJson(github.event.commits), '[ci skip]') && !contains(toJson(github.event.commits), '[skip ci]')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: true
# - 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
- uses: golangci/golangci-lint-action@v3
- name: install goreleaser
uses: goreleaser/goreleaser-action@v5
with:
install-only: true
- 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@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: true
- name: install goreleaser
uses: goreleaser/goreleaser-action@v5
with:
install-only: true
- 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@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: true
- name: install goreleaser
uses: goreleaser/goreleaser-action@v5
with:
install-only: true
- 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