Skip to content

Commit becfccb

Browse files
committed
Add version to output, embed tag as version in action
1 parent abe6845 commit becfccb

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

.github/workflows/main.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,32 @@ jobs:
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
13-
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # 5.5.0
13+
- name: Set up Go
14+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # 5.5.0
1415
with:
1516
go-version: '>=1.21.0'
16-
- run: go version
17+
- name: Display Go version
18+
run: go version
19+
- name: Get the version tag
20+
id: get-tag
21+
if: startsWith(github.ref, 'refs/tags/')
22+
run: echo "tag=${GITHUB_REF##*/}" >> $env:GITHUB_OUTPUT
1723
- name: Windows Build
1824
run: |
1925
$Env:GOOS='windows'
20-
go build -o GoReSym.exe
26+
go build -ldflags="-X main.Version=${{ steps.get-tag.outputs.tag }}" -o GoReSym.exe
2127
Compress-Archive -DestinationPath GoReSym-windows.zip -LiteralPath ./GoReSym.exe -CompressionLevel Fastest
2228
Remove-Item ./GoReSym.exe
2329
- name: Linux Build
2430
run: |
2531
$Env:GOOS='linux'
26-
go build -o GoReSym
32+
go build -ldflags="-X main.Version=${{ steps.get-tag.outputs.tag }}" -o GoReSym
2733
Compress-Archive -DestinationPath GoReSym-linux.zip -LiteralPath ./GoReSym -CompressionLevel Fastest
2834
Remove-Item ./GoReSym
2935
- name: Mac Build
3036
run: |
3137
$Env:GOOS='darwin'
32-
go build -o GoReSym
38+
go build -ldflags="-X main.Version=${{ steps.get-tag.outputs.tag }}" -o GoReSym
3339
Compress-Archive -DestinationPath GoReSym-mac.zip -LiteralPath ./GoReSym -CompressionLevel Fastest
3440
Remove-Item ./GoReSym
3541
- name: Release Windows
@@ -45,6 +51,5 @@ jobs:
4551
- name: Release Mac
4652
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # 2.3.2
4753
if: startsWith(github.ref, 'refs/tags/')
48-
with:
49-
files: GoReSym-mac.zip
50-
54+
with:
55+
files: GoReSym-mac.zip

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ func TextToJson(key string, text string) string {
414414
return fmt.Sprintf("{\"%s\": \"%s\"}", key, text)
415415
}
416416

417+
var Version = "dev-local-build"
418+
417419
func main() {
418420
stdout := bufio.NewWriter(os.Stdout)
419421
defer stdout.Flush()
@@ -432,6 +434,7 @@ func main() {
432434
flag.Parse()
433435

434436
if *about {
437+
fmt.Printf("Version: %s", Version)
435438
fmt.Println("GoReSym is a Golang symbol recovery tool by Google's Mandiant FLARE team. Maintained by Stephen Eckels.")
436439
fmt.Println("LICENSE MIT: https://github.com/mandiant/GoReSym/blob/master/LICENSE")
437440
fmt.Println("Dependencies:")

0 commit comments

Comments
 (0)