From ffb1d1f28fc155e45900082dd611019ce315a498 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Tue, 9 Nov 2021 18:07:05 -0800 Subject: [PATCH] [lbry] ci: setup goreleaser --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++ .goreleaser.yml | 57 +++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..92cffcc4d0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: goreleaser + +on: + workflow_dispatch: + inputs: + note: + description: 'Note' + required: false + default: '' + pull_request: + push: + tags: + - '*' + +permissions: + contents: write + +jobs: + goreleaser: + 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.17.3 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - + name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: lbcd-${{ github.sha }} + path: | + dist/checksums.txt + dist/*.tar.gz diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000000..db30c7fe97 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,57 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... +builds: + - + main: . + id: "lbcd" + binary: "lbcd" + env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -s -w + - -X main.appBuild={{.Commit}} + targets: + - linux_amd64 + - linux_arm64 + - darwin_amd64 + - darwin_arm64 + - windows_amd64 + - + main: ./cmd/lbcctl + id: "lbcctl" + binary: "lbcctl" + flags: + - -trimpath + ldflags: + - -s -w + - -X main.appBuild={{.Commit}} + env: + - CGO_ENABLED=0 + targets: + - linux_amd64 + - linux_arm64 + - darwin_amd64 + - darwin_arm64 + - windows_amd64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +release: + draft: true + prerelease: auto