trying again with ldflags + fixed update url

This commit is contained in:
David Dworken 2022-04-08 22:56:44 -07:00
parent f2c6f86204
commit 108e1526b8
5 changed files with 6 additions and 12 deletions

View File

@ -20,7 +20,7 @@ jobs:
fetch-depth: 0
- id: ldflags
run: |
echo "::set-output name=ldflags::$(./scripts/client-ldflags)"
echo "::set-output name=value::$(./scripts/client-ldflags)"
# Trusted builder.
build:

View File

@ -2,16 +2,10 @@ test:
HISHTORY_TEST=1 go test -p 1 ./...
release:
expr `cat VERSION` + 1 > VERSION
git tag v0.`cat VERSION`
expr `cat VERSION` + 1 > VERSION
git push --tags
build-binary:
go build -trimpath -o web/landing/www/binaries/hishtory-linux -ldflags "-X main.GitCommit=`git rev-list -1 HEAD`"
install: build-binary
web/landing/www/binaries/hishtory-linux install
build-static: build-binary
docker build -t gcr.io/dworken-k8s/hishtory-static -f web/caddy/Dockerfile .
@ -26,5 +20,5 @@ deploy-api: build-api
docker push gcr.io/dworken-k8s/hishtory-api
kubectl patch deployment hishtory-api -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"ts\":\"`date|sed -e 's/ /_/g'|sed -e 's/:/-/g'`\"}}}}}}"
deploy: deploy-static deploy-api
deploy: deploy-static deploy-api release

View File

@ -1 +1 @@
5
7

View File

@ -385,7 +385,7 @@ func copyFile(src, dst string) error {
func Update(url string) error {
var stdout bytes.Buffer
var stderr bytes.Buffer
cmd := exec.Command("bash", "-c", "curl -o /tmp/hishtory-client "+url+"; chmod +x /tmp/hishtory-client")
cmd := exec.Command("bash", "-c", "curl -L -o /tmp/hishtory-client "+url+"; chmod +x /tmp/hishtory-client")
cmd.Stdout = &stdout
cmd.Stderr = &stderr
err := cmd.Run()

View File

@ -49,7 +49,7 @@ func main() {
fmt.Print(GitCommit)
fmt.Print("\n")
case "update":
lib.CheckFatalError(lib.Update("https://hishtory.dev/binaries/hishtory-linux"))
lib.CheckFatalError(lib.Update("https://api.hishtory.dev/download/hishtory-linux-amd64"))
default:
lib.CheckFatalError(fmt.Errorf("unknown command: %s", os.Args[1]))
}