mirror of
https://github.com/Alexey71/opera-proxy.git
synced 2026-05-14 14:40:59 +00:00
Merge pull request #113 from Snawoot/buildinfo_ver
Use buildinfo for version information
This commit is contained in:
@@ -14,16 +14,6 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
|
||||||
name: Find Git Tag
|
|
||||||
id: tagger
|
|
||||||
uses: jimschubert/query-tag-action@v2
|
|
||||||
with:
|
|
||||||
include: 'v*'
|
|
||||||
exclude: '*-rc*'
|
|
||||||
commit-ish: 'HEAD'
|
|
||||||
skip-unshallow: 'true'
|
|
||||||
abbrev: 7
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
@@ -59,4 +49,3 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
build-args: 'GIT_DESC=${{steps.tagger.outputs.tag}}'
|
|
||||||
|
|||||||
+1
-3
@@ -1,11 +1,9 @@
|
|||||||
FROM --platform=$BUILDPLATFORM golang:1 AS build
|
FROM --platform=$BUILDPLATFORM golang:1 AS build
|
||||||
|
|
||||||
ARG GIT_DESC=undefined
|
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/Snawoot/opera-proxy
|
WORKDIR /go/src/github.com/Snawoot/opera-proxy
|
||||||
COPY . .
|
COPY . .
|
||||||
ARG TARGETOS TARGETARCH
|
ARG TARGETOS TARGETARCH
|
||||||
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -a -tags netgo -ldflags '-s -w -extldflags "-static" -X main.version='"$GIT_DESC"
|
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -a -tags netgo -ldflags '-s -w -extldflags "-static"'
|
||||||
ADD https://curl.haxx.se/ca/cacert.pem /certs.crt
|
ADD https://curl.haxx.se/ca/cacert.pem /certs.crt
|
||||||
RUN chmod 0644 /certs.crt
|
RUN chmod 0644 /certs.crt
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
PROGNAME = opera-proxy
|
PROGNAME = opera-proxy
|
||||||
OUTSUFFIX = bin/$(PROGNAME)
|
OUTSUFFIX = bin/$(PROGNAME)
|
||||||
VERSION := $(shell git describe)
|
|
||||||
BUILDOPTS = -a -tags netgo -trimpath -asmflags -trimpath
|
BUILDOPTS = -a -tags netgo -trimpath -asmflags -trimpath
|
||||||
LDFLAGS = -ldflags '-s -w -extldflags "-static" -X main.version=$(VERSION)'
|
LDFLAGS = -ldflags '-s -w -extldflags "-static"'
|
||||||
LDFLAGS_NATIVE = -ldflags '-s -w -X main.version=$(VERSION)'
|
LDFLAGS_NATIVE = -ldflags '-s -w'
|
||||||
|
|
||||||
NDK_CC_ARM = $(abspath ../../ndk-toolchain-arm/bin/arm-linux-androideabi-gcc)
|
NDK_CC_ARM = $(abspath ../../ndk-toolchain-arm/bin/arm-linux-androideabi-gcc)
|
||||||
NDK_CC_ARM64 = $(abspath ../../ndk-toolchain-arm64/bin/aarch64-linux-android21-clang)
|
NDK_CC_ARM64 = $(abspath ../../ndk-toolchain-arm64/bin/aarch64-linux-android21-clang)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime/debug"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -35,10 +36,6 @@ const (
|
|||||||
PROXY_SUFFIX = "sec-tunnel.com"
|
PROXY_SUFFIX = "sec-tunnel.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
version = "undefined"
|
|
||||||
)
|
|
||||||
|
|
||||||
func perror(msg string) {
|
func perror(msg string) {
|
||||||
fmt.Fprintln(os.Stderr, "")
|
fmt.Fprintln(os.Stderr, "")
|
||||||
fmt.Fprintln(os.Stderr, msg)
|
fmt.Fprintln(os.Stderr, msg)
|
||||||
@@ -209,7 +206,7 @@ func proxyFromURLWrapper(u *url.URL, next xproxy.Dialer) (xproxy.Dialer, error)
|
|||||||
func run() int {
|
func run() int {
|
||||||
args := parse_args()
|
args := parse_args()
|
||||||
if args.showVersion {
|
if args.showVersion {
|
||||||
fmt.Println(version)
|
fmt.Println(version())
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,3 +585,11 @@ func retryPolicy(retries int, retryInterval time.Duration, logger *clog.CondLogg
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func version() string {
|
||||||
|
bi, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok {
|
||||||
|
return "unknown"
|
||||||
|
}
|
||||||
|
return bi.Main.Version
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user