diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..29b666d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.20 + - name: Test + run: make test + + goreleaser: + needs: test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Fetch all tags + run: git fetch --force --tags + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.20 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: ${{ env.GITHUB_REF_NAME }} + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.PUBLISHER_TOKEN }} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0b7952f --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +BINARY_NAME=obp + +build-all: + GOOS=darwin GOARCH=amd64 go build -o bin/${BINARY_NAME}-darwin + GOOS=linux GOARCH=amd64 go build -o bin/${BINARY_NAME}-linux + GOOS=windows GOARCH=amd64 go build -o bin/${BINARY_NAME}-windows.exe + +clean-all: + go clean + rm bin/${BINARY_NAME}-darwin + rm bin/${BINARY_NAME}-linux + rm bin/${BINARY_NAME}-windows.exe + +test: + go test ./... + +test_coverage: + go test ./... -coverprofile=coverage.out