Skip to content

Commit dea899c

Browse files
committed
Add version for main.go & pocketbase
1 parent b047478 commit dea899c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ jobs:
6262
6363
export TAG_NAME=${GITHUB_REF#refs/tags/}
6464
65-
GOOS=linux GOARCH=amd64 go build -o "pdnode-cp-${TAG_NAME}-linux" .
66-
GOOS=windows GOARCH=amd64 go build -o "pdnode-cp-${TAG_NAME}-windows.exe" .
65+
GOOS=linux GOARCH=amd64 go build -ldflags "-X 'main.Version=${{github.ref_name}}'" -o "pdnode-cp-${TAG_NAME}-linux" .
66+
GOOS=windows GOARCH=amd64 go build -ldflags "-X 'main.Version=${{github.ref_name}}'" -o "pdnode-cp-${TAG_NAME}-windows.exe" .
6767
6868
- name: Create Release
6969
uses: softprops/action-gh-release@v2

main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
//go:embed all:pb_public
2121
var embeddedFiles embed.FS
2222

23+
var Version = "untracked"
24+
2325
func main() {
2426
app := pocketbase.New()
2527

@@ -28,6 +30,8 @@ func main() {
2830
app.Logger().Warn("Warning: .env file not found, using system environment variables", "err", err)
2931
}
3032

33+
app.RootCmd.Version = Version
34+
3135
migratecmd.MustRegister(app, app.RootCmd, migratecmd.Config{
3236
// enable auto creation of migration files when making collection changes in the Dashboard
3337
// (the IsProbablyGoRun check is to enable it only during development)

0 commit comments

Comments
 (0)