Skip to content

Merge pull request #36 from joemiller/fix-release #155

Merge pull request #36 from joemiller/fix-release

Merge pull request #36 from joemiller/fix-release #155

Workflow file for this run

name: main
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
test:
strategy:
matrix:
go-version: [1.19.x, 1.20.x, 1.21.x]
os: [ubuntu-latest, macos-latest, windows-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/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
# TODO: switch to using the golangci-lint github action
- name: install golangci-lint
run: |
mkdir -p "$HOME/bin"
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.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')
uses: goreleaser/goreleaser-action@v2
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 main since we will run a full release:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Install GoReleaser
if: startsWith(runner.os, 'Linux')
uses: goreleaser/goreleaser-action@v2
with:
install-only: true
- run: make snapshot
release:
needs: [test]
# only create a release on main builds:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: docker.io login
run: docker login docker.io -u joemiller -p ${{ secrets.DOCKERIO_TOKEN }}
- name: Install GoReleaser
if: startsWith(runner.os, 'Linux')
uses: goreleaser/goreleaser-action@v2
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