From f0f1a03a57d985a0b1896268a3395bff428dc07b Mon Sep 17 00:00:00 2001 From: Anchit Bajaj Date: Tue, 31 Jan 2023 21:51:37 +0530 Subject: [PATCH] Add goreleaser --- .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ .gitignore | 3 ++- .goreleaser.yaml | 17 +++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cfa54c3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]*" + +name: Create release and upload binaries + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + go-version: '>=1.17.0' + cache: true + + - uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 9f9a20c..9704d08 100755 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ out dump bin HookMsg -config.yaml \ No newline at end of file +config.yaml +dist diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..3af847c --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,17 @@ +project_name: hookmsg + +build: + env: + - CGO_ENABLED=0 + + main: ./cmd/hookmsg + binary: hookmsg + goos: + - linux + goarch: + - amd64 + - arm64 + +archives: + - name_template: "{{.Os}}-{{.Arch}}-{{ .ProjectName }}" + format: tar.gz