mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
8971e2feba
Adds electron-builder, which we will use to package and distribute our application, same as in the existing app. Replaces explicit port assignments with dynamic ones, which are then stored into environment variables. Adds a ~/.w2-dev folder for use when running a dev build. The build-helper pipeline from the old repo is included here too, but it is not updated yet so it will fail. Also removes some redundant utility functions and cleans up some let vs. const usage. The packaging can be run using the `package:prod` and `package:dev` tasks. --------- Co-authored-by: sawka <mike.sawka@gmail.com>
138 lines
3.6 KiB
YAML
138 lines
3.6 KiB
YAML
# Copyright 2024, Command Line Inc.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
version: "3"
|
|
|
|
vars:
|
|
APP_NAME: "NextWave"
|
|
BIN_DIR: "bin"
|
|
VERSION:
|
|
sh: node version.cjs
|
|
|
|
tasks:
|
|
|
|
package:dev:
|
|
cmds:
|
|
- yarn build:dev && yarn electron-builder -c electron-builder.config.cjs -p never
|
|
deps:
|
|
- generate
|
|
- build:server
|
|
- build:wsh
|
|
|
|
package:prod:
|
|
cmds:
|
|
- yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never
|
|
deps:
|
|
- generate
|
|
- build:server
|
|
- build:wsh
|
|
|
|
electron:dev:
|
|
cmds:
|
|
- WAVETERM_DEV=1 yarn dev
|
|
deps:
|
|
- generate
|
|
- build:server
|
|
- build:wsh
|
|
|
|
electron:start:
|
|
cmds:
|
|
- WAVETERM_DEV=1 yarn start
|
|
deps:
|
|
- generate
|
|
- build:server
|
|
- build:wsh
|
|
|
|
generate:
|
|
cmds:
|
|
- go run cmd/generate/main-generate.go
|
|
- go run cmd/generatewshclient/main-generatewshclient.go
|
|
sources:
|
|
- "cmd/generate/*.go"
|
|
- "pkg/service/**/*.go"
|
|
- "pkg/wstore/*.go"
|
|
- "pkg/wshrpc/**/*.go"
|
|
|
|
build:server:
|
|
deps:
|
|
- task: build:server:internal
|
|
vars:
|
|
GOARCH: arm64
|
|
- task: build:server:internal
|
|
vars:
|
|
GOARCH: amd64
|
|
|
|
build:server:internal:
|
|
requires:
|
|
vars:
|
|
- GOARCH
|
|
cmds:
|
|
- CGO_ENABLED=1 GOARCH={{.GOARCH}} go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wavesrv.{{.GOARCH}}{{exeExt}} cmd/server/main-server.go
|
|
sources:
|
|
- "cmd/server/*.go"
|
|
- "pkg/**/*.go"
|
|
generates:
|
|
- dist/bin/wavesrv.{{.GOARCH}}{{exeExt}}
|
|
deps:
|
|
- go:mod:tidy
|
|
internal: true
|
|
|
|
build:wsh:
|
|
deps:
|
|
- task: build:wsh:internal
|
|
vars:
|
|
GOOS: darwin
|
|
GOARCH: arm64
|
|
- task: build:wsh:internal
|
|
vars:
|
|
GOOS: darwin
|
|
GOARCH: amd64
|
|
- task: build:wsh:internal
|
|
vars:
|
|
GOOS: linux
|
|
GOARCH: arm64
|
|
- task: build:wsh:internal
|
|
vars:
|
|
GOOS: linux
|
|
GOARCH: amd64
|
|
- task: build:wsh:internal
|
|
vars:
|
|
GOOS: windows
|
|
GOARCH: amd64
|
|
- task: build:wsh:internal
|
|
vars:
|
|
GOOS: windows
|
|
GOARCH: arm64
|
|
|
|
build:wsh:internal:
|
|
vars:
|
|
GO_LDFLAGS:
|
|
sh: echo "-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
|
|
EXT:
|
|
sh: echo {{if eq .GOOS "windows"}}.exe{{end}}
|
|
requires:
|
|
vars:
|
|
- GOOS
|
|
- GOARCH
|
|
- VERSION
|
|
sources:
|
|
- "cmd/wsh/**/*.go"
|
|
- "pkg/**/*.go"
|
|
generates:
|
|
- dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.GOARCH}}{{.EXT}}
|
|
cmds:
|
|
- (CGO_ENABLED=0 GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -ldflags="{{.GO_LDFLAGS}}" -o dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.GOARCH}}{{.EXT}} cmd/wsh/main-wsh.go)
|
|
deps:
|
|
- go:mod:tidy
|
|
internal: true
|
|
|
|
go:mod:tidy:
|
|
summary: Runs `go mod tidy`
|
|
internal: true
|
|
generates:
|
|
- go.sum
|
|
sources:
|
|
- go.mod
|
|
cmds:
|
|
- go mod tidy
|