From cd5cb372279dc7f2058a8e169a7c4fccedc5e36e Mon Sep 17 00:00:00 2001 From: Darren Kelly <107671032+darrenvechain@users.noreply.github.com> Date: Fri, 23 Aug 2024 13:49:08 +0100 Subject: [PATCH] feat: add goreleaser to publish binaries (#40) --- .github/workflows/on-release.yaml | 12 ++++++++ .gitignore | 2 ++ .goreleaser.yaml | 47 +++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/on-release.yaml b/.github/workflows/on-release.yaml index 9091e5d75..0f5f70b25 100644 --- a/.github/workflows/on-release.yaml +++ b/.github/workflows/on-release.yaml @@ -19,6 +19,10 @@ jobs: with: node-version: '20' + - uses: actions/setup-go@v5 + with: + go-version: '1.22' + - name: Validate Tag run: | node -e "if (!/^v\d+\.\d+\.\d+$/.test('${{ github.ref_name }}')) { console.error('Invalid version provided');process.exit(1);}" @@ -44,6 +48,14 @@ jobs: exit 1 fi + - name: Publish Binaries + uses: goreleaser/goreleaser-action@v6 + with: + version: '~> v2' + args: release --clean --timeout=90m + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + publish-docker-image: name: Publish Docker Image uses: ./.github/workflows/publish-docker-images.yaml diff --git a/.gitignore b/.gitignore index 9667c7a2d..ea591b4e1 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ package.json coverage.out .idea + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 000000000..9276d4af3 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,47 @@ +# goreleaser is currently used to attach binaries to github releases +# it can be exteneded in the future to also publish docker images, brew, chocolatey, etc. +version: 2 + +before: + hooks: + - go mod tidy + - go mod vendor + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + main: ./cmd/thor/main.go + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + main: ./cmd/disco/main.go + command: make disco + +release: + github: + owner: vechain + name: thor + +archives: + - format: tar.gz + wrap_in_directory: true + format_overrides: + - goos: windows + format: zip + name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + files: + - LICENSE + - README.md