diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d1cd7b9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: build +on: + push: + branches: + - '*' + pull_request: {} + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: 'go.mod' + - run: "go vet ./..." + - name: Lint + uses: dominikh/staticcheck-action@v1.3.0 + with: + version: "2022.1.3" + snapshot-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + - name: Set GOLANG_VERSION + run: | + echo "GOLANG_VERSION=$(go version | awk '{ print $3 }')" >> $GITHUB_ENV + - name: Snapshot Build + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --snapshot --skip=publish --clean \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bbc6cbe --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: release +on: + push: + tags: + - 'v*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v3 + with: + go-version-file: 'go.mod' + - name: Set GOLANG_VERSION + run: | + echo "GOLANG_VERSION=$(go version | awk '{ print $3 }')" >> $GITHUB_ENV + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: docker.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Tagged Release + uses: goreleaser/goreleaser-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + distribution: goreleaser + version: latest + args: release --clean \ No newline at end of file