mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 03:07:20 +08:00
workflow: 更新ci文件
This commit is contained in:
30
.github/workflows/backend.yml
vendored
30
.github/workflows/backend.yml
vendored
@@ -37,15 +37,14 @@ jobs:
|
||||
path: internal/embed/frontend
|
||||
check_artifacts: true
|
||||
- name: Set build info
|
||||
id: build_info
|
||||
run: |
|
||||
echo "version=$(git describe --tags --abbrev=0 2>/dev/null || echo '0.0.0')" >> $GITHUB_OUTPUT
|
||||
echo "build_time=$(date -u '+%F %T UTC')" >> $GITHUB_OUTPUT
|
||||
echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
echo "go_version=$(go version | cut -d' ' -f3)" >> $GITHUB_OUTPUT
|
||||
echo "build_user=$(whoami)" >> $GITHUB_OUTPUT
|
||||
echo "build_host=$(hostname)" >> $GITHUB_OUTPUT
|
||||
echo "build_id=${{ github.run_id }}" >> $GITHUB_OUTPUT
|
||||
echo "VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo '0.0.0')" >> $GITHUB_ENV
|
||||
echo "BUILD_TIME=$(date -u '+%F %T UTC')" >> $GITHUB_ENV
|
||||
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
echo "GO_VERSION=$(go version | cut -d' ' -f3)" >> $GITHUB_ENV
|
||||
echo "BUILD_ID=${{ github.run_id }}" >> $GITHUB_ENV
|
||||
echo "BUILD_USER=$(whoami)" >> $GITHUB_ENV
|
||||
echo "BUILD_HOST=$(hostname)" >> $GITHUB_ENV
|
||||
- name: Build ${{ matrix.goarch }}
|
||||
env:
|
||||
CGO_ENABLED: 0
|
||||
@@ -53,14 +52,13 @@ jobs:
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
run: |
|
||||
LDFLAGS="-s -w --extldflags '-static'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.Version=${{ steps.build_info.outputs.version }}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.BuildTime=${{ steps.build_info.outputs.build_time }}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.CommitHash=${{ steps.build_info.outputs.commit_hash }}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.GoVersion=${{ steps.build_info.outputs.go_version }}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.Platform=${{ steps.build_info.outputs.platform }}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.BuildUser=${{ steps.build_info.outputs.build_user }}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.BuildHost=${{ steps.build_info.outputs.build_host }}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.BuildID=${{ steps.build_info.outputs.build_id }}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.Version=${VERSION}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.BuildTime=${BUILD_TIME}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.CommitHash=${COMMIT_HASH}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.GoVersion=${GO_VERSION}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.BuildID=${BUILD_ID}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.BuildUser=${BUILD_USER}'"
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/TheTNB/panel/internal/app.BuildHost=${BUILD_HOST}'"
|
||||
go build -ldflags "${LDFLAGS}" -o web-${{ matrix.goarch }} ./cmd/web
|
||||
go build -ldflags "${LDFLAGS}" -o cli-${{ matrix.goarch }} ./cmd/cli
|
||||
- name: Compress ${{ matrix.goarch }}
|
||||
|
||||
3
.github/workflows/goreleaser.yml
vendored
3
.github/workflows/goreleaser.yml
vendored
@@ -31,6 +31,9 @@ jobs:
|
||||
name: frontend
|
||||
path: internal/embed/frontend
|
||||
check_artifacts: true
|
||||
- name: Set environment variables
|
||||
run: |
|
||||
echo "GOVERSION=$(go version | cut -d' ' -f3)" >> $GITHUB_ENV
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
|
||||
@@ -14,6 +14,13 @@ builds:
|
||||
- arm64
|
||||
ldflags:
|
||||
- -s -w --extldflags "-static"
|
||||
- -X 'github.com/TheTNB/panel/internal/app.Version={{ .Version }}'
|
||||
- -X 'github.com/TheTNB/panel/internal/app.BuildTime={{ .Now.Format "2006-01-02 15:04:05 MST" }}'
|
||||
- -X 'github.com/TheTNB/panel/internal/app.CommitHash={{ .ShortCommit }}'
|
||||
- -X 'github.com/TheTNB/panel/internal/app.GoVersion={{ .Env.GOVERSION }}'
|
||||
- -X 'github.com/TheTNB/panel/internal/app.BuildID={{ .Env.GITHUB_RUN_ID }}'
|
||||
- -X 'github.com/TheTNB/panel/internal/app.BuildUser={{ .Env.USER }}'
|
||||
- -X 'github.com/TheTNB/panel/internal/app.BuildHost={{ .Env.HOSTNAME }}'
|
||||
- id: cli
|
||||
main: ./cmd/cli
|
||||
binary: cli
|
||||
|
||||
@@ -52,7 +52,7 @@ var (
|
||||
BuildTime string
|
||||
CommitHash string
|
||||
GoVersion string
|
||||
BuildID string
|
||||
BuildUser string
|
||||
BuildHost string
|
||||
BuildID string
|
||||
)
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-rat/chix"
|
||||
"github.com/go-rat/utils/collect"
|
||||
@@ -103,15 +104,17 @@ func (s *DashboardService) SystemInfo(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
time.Now().UTC()
|
||||
|
||||
Success(w, chix.M{
|
||||
"procs": hostInfo.Procs,
|
||||
"hostname": hostInfo.Hostname,
|
||||
"panel_version": app.Version,
|
||||
"commit_hash": app.CommitHash,
|
||||
"build_id": app.BuildID,
|
||||
"build_time": app.BuildTime,
|
||||
"build_user": app.BuildUser,
|
||||
"build_host": app.BuildHost,
|
||||
"build_id": app.BuildID,
|
||||
"go_version": app.GoVersion,
|
||||
"kernel_arch": hostInfo.KernelArch,
|
||||
"kernel_version": hostInfo.KernelVersion,
|
||||
|
||||
@@ -157,10 +157,10 @@ export interface SystemInfo {
|
||||
hostname: string
|
||||
panel_version: string
|
||||
commit_hash: string
|
||||
build_id: string
|
||||
build_time: string
|
||||
build_user: string
|
||||
build_host: string
|
||||
build_id: string
|
||||
go_version: string
|
||||
kernel_arch: string
|
||||
kernel_version: string
|
||||
|
||||
Reference in New Issue
Block a user