Merge pull request #47 from bdwyertech/dependabot/go_modules/golang.o… #282
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: Go | |
on: [push] | |
jobs: | |
test: | |
name: Build | |
strategy: | |
matrix: | |
go: ['1.21'] | |
runs-on: ubuntu-latest | |
container: golang:${{ matrix.go }} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Git Info | |
id: git | |
run: | | |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} | |
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} | |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | |
- name: Test | |
env: | |
GOFLAGS: '-mod=vendor' | |
STATICCHECK_VERSION: '2023.1.6' | |
run: | | |
git config --global --add safe.directory $GITHUB_WORKSPACE | |
wget -qO- https://github.com/dominikh/go-tools/releases/download/${STATICCHECK_VERSION}/staticcheck_linux_amd64.tar.gz | tar zxf - --directory /usr/local/bin --strip-components=1 staticcheck/staticcheck | |
go fmt $(go list ./... | grep -v /vendor/) | xargs -I {} -r /bin/sh -c "/bin/echo {} && exit 1" | |
go vet $(go list ./... | grep -v /vendor/) | |
staticcheck --version | |
staticcheck $(go list ./... | grep -v /vendor/) | |
go build . | |
- name: Run GoReleaser | |
if: startsWith(github.ref, 'refs/tags/') && (matrix.go == '1.21') | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
version: latest | |
args: release | |
# key: ${{ secrets.GPG_CODE_SIGN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |