Skip to content

Commit ea4cddf

Browse files
authored
Darren/feat/publish binaries 2 (#44)
* feat: publish binaries for releases * chore: remove gorelease * testing: goreleaser
1 parent f61cd1e commit ea4cddf

File tree

10 files changed

+203
-5
lines changed

10 files changed

+203
-5
lines changed

.github/workflows/on-pre-release.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,12 @@ jobs:
4141
ghcr.io/${{ github.repository }}
4242
tags: |
4343
type=raw,value=${{ github.ref_name }}
44+
45+
publish-binaries:
46+
name: Publish Binaries
47+
uses: ./.github/workflows/release-binaries.yaml
48+
secrets: inherit
49+
needs:
50+
- validate
51+
permissions:
52+
contents: write

.github/workflows/on-release.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,12 @@ jobs:
7070
tags: |
7171
type=raw,value=${{ github.ref_name }}
7272
type=raw,value=latest
73+
74+
publish-binaries:
75+
name: Publish Binaries
76+
uses: ./.github/workflows/release-binaries.yaml
77+
secrets: inherit
78+
needs:
79+
- validate
80+
permissions:
81+
contents: write
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Release Binaries
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
binary:
7+
options:
8+
- thor
9+
- disco
10+
description: 'Select the binary to build and release'
11+
type: choice
12+
required: true
13+
default: thor
14+
workflow_call:
15+
inputs:
16+
binary:
17+
description: 'Select the binary to build and release'
18+
type: string
19+
required: true
20+
default: thor
21+
22+
permissions:
23+
contents: write
24+
25+
jobs:
26+
build-binaries:
27+
runs-on: ${{ matrix.hostos }}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
include:
32+
- goos: linux
33+
goarch: amd64
34+
hostos: ubuntu-latest
35+
- goos: linux
36+
goarch: arm64
37+
hostos: ubuntu-24.04-arm
38+
- goos: darwin
39+
goarch: arm64
40+
hostos: macos-latest
41+
- goos: windows
42+
goarch: amd64
43+
hostos: windows-latest
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v5
47+
with:
48+
fetch-depth: 0
49+
50+
- name: Set up Go
51+
uses: actions/setup-go@v5
52+
with:
53+
go-version: 1.24
54+
55+
- name: Install GoReleaser
56+
uses: goreleaser/goreleaser-action@v6
57+
with:
58+
install-only: true
59+
60+
# - name: Import GPG key
61+
# id: import_gpg
62+
# uses: crazy-max/ghaction-import-gpg@v6
63+
# with:
64+
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
65+
# passphrase: ${{ secrets.PASSPHRASE }}
66+
67+
- name: Set Env
68+
run: |
69+
echo "BINARY=${{ inputs.binary || 'thor' }}" >> $GITHUB_ENV
70+
echo "BIN_EXT=${{ matrix.goos == 'windows' && '.exe' || '' }}" >> $GITHUB_ENV
71+
echo "THOR_VERSION=$(cat ./cmd/thor/VERSION | tr -d '\n')" >> $GITHUB_ENV
72+
echo "DISCO_VERSION=$(cat ./cmd/disco/VERSION | tr -d '\n')" >> $GITHUB_ENV
73+
echo "COPYRIGHT_YEAR=$(git --no-pager log -1 --format=%ad --date=format:%Y)" >> $GITHUB_ENV
74+
75+
- name: Build Binary
76+
run: goreleaser build --single-target --id ${{ env.BINARY }} --clean
77+
env:
78+
DISCO_VERSION: ${{ env.DISCO_VERSION }}
79+
THOR_VERSION: ${{ env.THOR_VERSION }}
80+
COPYRIGHT_YEAR: ${{ env.COPYRIGHT_YEAR }}
81+
#GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
82+
83+
- name: Debug
84+
run: |
85+
ls -lh ./dist
86+
87+
- name: Upload Artifacts
88+
uses: actions/upload-artifact@v4
89+
with:
90+
path: ./dist/${{ env.BINARY}}*
91+
name: 'binaries'
92+
93+
publish-binaries:
94+
needs: build-binaries
95+
runs-on: ubuntu-latest
96+
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' }}
97+
steps:
98+
- name: Download Artifacts
99+
uses: actions/download-artifact@v5
100+
with:
101+
name: 'binaries'
102+
path: './dist'
103+
104+
# - name: Import GPG key
105+
# id: import_gpg
106+
# uses: crazy-max/ghaction-import-gpg@v6
107+
# with:
108+
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
109+
# passphrase: ${{ secrets.PASSPHRASE }}
110+
111+
- name: Install GoReleaser
112+
uses: goreleaser/goreleaser-action@v6
113+
with:
114+
distribution: goreleaser
115+
version: "~> v2"
116+
args: release
117+
env:
118+
# GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ package.json
2929
coverage.out
3030

3131
.idea
32+
33+
dist/

.goreleaser.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- id: thor
9+
main: ./cmd/thor
10+
binary: thor
11+
ldflags:
12+
- >-
13+
-X main.version={{ .Env.THOR_VERSION }}
14+
-X main.gitCommit={{ .Commit }}
15+
-X main.gitTag={{ .Tag }}
16+
-X main.copyrightYear={{ .Env.COPYRIGHT_YEAR }}
17+
goos:
18+
- linux
19+
- darwin
20+
- windows
21+
goarch:
22+
- amd64
23+
- arm64
24+
25+
- id: disco
26+
main: ./cmd/disco
27+
binary: disco
28+
ldflags:
29+
- >-
30+
-X main.version={{ .Env.DISCO_VERSION }}
31+
-X main.gitCommit={{ .Commit }}
32+
-X main.gitTag={{ .Tag }}
33+
-X main.copyrightYear={{ .Env.COPYRIGHT_YEAR }}
34+
goos:
35+
- linux
36+
- darwin
37+
- windows
38+
goarch:
39+
- amd64
40+
- arm64
41+
42+
archives:
43+
- format: tar.gz
44+
name_template: >-
45+
{{ .ProjectName }}_
46+
{{- title .Os }}_
47+
{{- if eq .Arch "amd64" }}x86_64
48+
{{- else if eq .Arch "386" }}i386
49+
{{- else }}{{ .Arch }}{{ end }}
50+
{{- if .Arm }}v{{ .Arm }}{{ end }}
51+
format_overrides:
52+
- goos: windows
53+
format: zip
54+
55+
changelog:
56+
sort: asc
57+
filters:
58+
exclude:
59+
- "^docs:"
60+
- "^test:"

api/doc/thor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ info:
1212
license:
1313
name: LGPL 3.0
1414
url: https://www.gnu.org/licenses/lgpl-3.0.en.html
15-
version: 2.3.1
15+
version: 2.4.0
1616
servers:
1717
- url: /
1818
description: Current Node

cmd/thor/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.1
1+
2.4.0

tracers/logger/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type Config struct {
6060
Limit int // maximum length of output, but zero means unlimited
6161
}
6262

63-
//go:generate go run github.com/fjl/gencodec -type StructLog -field-override structLogMarshaling -out gen_structlog.go
63+
//go:generate go run github.com/fjl/gencodec@v0.1.1 -type StructLog -field-override structLogMarshaling -out gen_structlog.go
6464

6565
// StructLog is emitted to the EVM each cycle and lists information about the current internal state
6666
// prior to the execution of the statement.

tracers/native/call.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"github.com/vechain/thor/v2/vm"
3030
)
3131

32-
//go:generate go run github.com/fjl/gencodec -type callFrame -field-override callFrameMarshaling -out gen_callframe_json.go
32+
//go:generate go run github.com/fjl/gencodec@v0.1.1 -type callFrame -field-override callFrameMarshaling -out gen_callframe_json.go
3333

3434
func init() {
3535
tracers.DefaultDirectory.Register("callTracer", newCallTracer, false)

tracers/native/prestate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"github.com/vechain/thor/v2/vm"
3131
)
3232

33-
//go:generate go run github.com/fjl/gencodec -type account -field-override accountMarshaling -out gen_account_json.go
33+
//go:generate go run github.com/fjl/gencodec@v0.1.1 -type account -field-override accountMarshaling -out gen_account_json.go
3434

3535
func init() {
3636
tracers.DefaultDirectory.Register("prestateTracer", newPrestateTracer, false)

0 commit comments

Comments
 (0)