Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
de4b52d3
authored
Nov 22, 2025
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: release workflow show version
parent
4dbbf06a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
.github/workflows/release.yml
+15
-9
common/init.go
+5
-0
No files found.
.github/workflows/release.yml
View file @
de4b52d3
...
@@ -22,6 +22,10 @@ jobs:
...
@@ -22,6 +22,10 @@ jobs:
uses
:
actions/checkout@v3
uses
:
actions/checkout@v3
with
:
with
:
fetch-depth
:
0
fetch-depth
:
0
-
name
:
Determine Version
run
:
|
VERSION=$(git describe --tags)
echo "VERSION=$VERSION" >> $GITHUB_ENV
-
uses
:
oven-sh/setup-bun@v2
-
uses
:
oven-sh/setup-bun@v2
with
:
with
:
bun-version
:
latest
bun-version
:
latest
...
@@ -31,7 +35,7 @@ jobs:
...
@@ -31,7 +35,7 @@ jobs:
run
:
|
run
:
|
cd web
cd web
bun install
bun install
DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$
(git describe --tags)
bun run build
DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$
VERSION
bun run build
cd ..
cd ..
-
name
:
Set up Go
-
name
:
Set up Go
uses
:
actions/setup-go@v3
uses
:
actions/setup-go@v3
...
@@ -40,13 +44,11 @@ jobs:
...
@@ -40,13 +44,11 @@ jobs:
-
name
:
Build Backend (amd64)
-
name
:
Build Backend (amd64)
run
:
|
run
:
|
go mod download
go mod download
VERSION=$(git describe --tags)
go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-$VERSION
go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-$VERSION
-
name
:
Build Backend (arm64)
-
name
:
Build Backend (arm64)
run
:
|
run
:
|
sudo apt-get update
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y gcc-aarch64-linux-gnu
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y gcc-aarch64-linux-gnu
VERSION=$(git describe --tags)
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-arm64-$VERSION
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-arm64-$VERSION
-
name
:
Release
-
name
:
Release
uses
:
softprops/action-gh-release@v2
uses
:
softprops/action-gh-release@v2
...
@@ -65,6 +67,10 @@ jobs:
...
@@ -65,6 +67,10 @@ jobs:
uses
:
actions/checkout@v3
uses
:
actions/checkout@v3
with
:
with
:
fetch-depth
:
0
fetch-depth
:
0
-
name
:
Determine Version
run
:
|
VERSION=$(git describe --tags)
echo "VERSION=$VERSION" >> $GITHUB_ENV
-
uses
:
oven-sh/setup-bun@v2
-
uses
:
oven-sh/setup-bun@v2
with
:
with
:
bun-version
:
latest
bun-version
:
latest
...
@@ -75,7 +81,7 @@ jobs:
...
@@ -75,7 +81,7 @@ jobs:
run
:
|
run
:
|
cd web
cd web
bun install
bun install
DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$
(git describe --tags)
bun run build
DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$
VERSION
bun run build
cd ..
cd ..
-
name
:
Set up Go
-
name
:
Set up Go
uses
:
actions/setup-go@v3
uses
:
actions/setup-go@v3
...
@@ -84,7 +90,6 @@ jobs:
...
@@ -84,7 +90,6 @@ jobs:
-
name
:
Build Backend
-
name
:
Build Backend
run
:
|
run
:
|
go mod download
go mod download
VERSION=$(git describe --tags)
go build -ldflags "-X 'new-api/common.Version=$VERSION'" -o new-api-macos-$VERSION
go build -ldflags "-X 'new-api/common.Version=$VERSION'" -o new-api-macos-$VERSION
-
name
:
Release
-
name
:
Release
uses
:
softprops/action-gh-release@v2
uses
:
softprops/action-gh-release@v2
...
@@ -105,6 +110,10 @@ jobs:
...
@@ -105,6 +110,10 @@ jobs:
uses
:
actions/checkout@v3
uses
:
actions/checkout@v3
with
:
with
:
fetch-depth
:
0
fetch-depth
:
0
-
name
:
Determine Version
run
:
|
VERSION=$(git describe --tags)
echo "VERSION=$VERSION" >> $GITHUB_ENV
-
uses
:
oven-sh/setup-bun@v2
-
uses
:
oven-sh/setup-bun@v2
with
:
with
:
bun-version
:
latest
bun-version
:
latest
...
@@ -114,7 +123,7 @@ jobs:
...
@@ -114,7 +123,7 @@ jobs:
run
:
|
run
:
|
cd web
cd web
bun install
bun install
DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$
(git describe --tags)
bun run build
DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$
VERSION
bun run build
cd ..
cd ..
-
name
:
Set up Go
-
name
:
Set up Go
uses
:
actions/setup-go@v3
uses
:
actions/setup-go@v3
...
@@ -123,7 +132,6 @@ jobs:
...
@@ -123,7 +132,6 @@ jobs:
-
name
:
Build Backend
-
name
:
Build Backend
run
:
|
run
:
|
go mod download
go mod download
VERSION=$(git describe --tags)
go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION'" -o new-api-$VERSION.exe
go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION'" -o new-api-$VERSION.exe
-
name
:
Release
-
name
:
Release
uses
:
softprops/action-gh-release@v2
uses
:
softprops/action-gh-release@v2
...
@@ -132,5 +140,3 @@ jobs:
...
@@ -132,5 +140,3 @@ jobs:
files
:
new-api-*.exe
files
:
new-api-*.exe
env
:
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
common/init.go
View file @
de4b52d3
...
@@ -30,6 +30,11 @@ func printHelp() {
...
@@ -30,6 +30,11 @@ func printHelp() {
func
InitEnv
()
{
func
InitEnv
()
{
flag
.
Parse
()
flag
.
Parse
()
envVersion
:=
os
.
Getenv
(
"VERSION"
)
if
envVersion
!=
""
{
Version
=
envVersion
}
if
*
PrintVersion
{
if
*
PrintVersion
{
fmt
.
Println
(
Version
)
fmt
.
Println
(
Version
)
os
.
Exit
(
0
)
os
.
Exit
(
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment