diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 0000000..5e6efdb --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,51 @@ +name: Build and Release + +on: + push: + branches: [ master ] + tags: [ '*.*.*' ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v2 + with: + go-version: '^1.17.0' + - name: Tidy + run: | + go mod tidy + + - name: Build + run: | + go build + + - name: Test + run: | + go test -race -shuffle=on + + github-publish: + # Only publish if all other jobs succeed + needs: + - test + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v2 + with: + go-version: '^1.20.0' + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}