mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
5b7535d08f
## New release flow 1. Run "Bump Version" workflow with the desired version bump and the prerelease flag set to `true`. This will push a new version bump to the target branch and create a new git tag. - See below for more info on how the version bumping works. 2. A new "Build Helper" workflow run will kick off automatically for the new tag. Once it is complete, test the new build locally by downloading with the [download script](https://github.com/wavetermdev/thenextwave/blob/main/scripts/artifacts/download-staged-artifact.sh). 3. Release the new build using the [publish script](https://github.com/wavetermdev/thenextwave/blob/main/scripts/artifacts/publish-from-staging.sh). This will trigger electron-updater to distribute the package to beta users. 4. Run "Bump Version" again with a release bump (either `major`, `minor`, or `patch`) and the prerelease flag set to `false`. 6. Release the new build to all channels using the [publish script](https://github.com/wavetermdev/thenextwave/blob/main/scripts/artifacts/publish-from-staging.sh). This will trigger electron-updater to distribute the package to all users. ## Change Summary Creates a new "Bump Version" workflow to manage versioning and tag creation. Build Helper is now automated. ### Version bumps Updates the `version.cjs` script so that an argument can be passed to trigger a version bump. Under the hood, this utilizes NPM's `semver` package. If arguments are present, the version will be bumped. If only a single argument is given, the following are valid inputs: - `none`: No-op. - `patch`: Bumps the patch version. - `minor`: Bumps the minor version. - `major`: Bumps the major version. - '1', 'true': Bumps the prerelease version. If two arguments are given, the first argument must be either `none`, `patch`, `minor`, or `major`. The second argument must be `1` or `true` to bump the prerelease version. ### electron-builder We are now using the release channels support in electron-builder. This will automatically detect the channel being built based on the package version to determine which channel update files need to be generated. See [here](https://www.electron.build/tutorials/release-using-channels.html) for more information. ### Github Actions #### Bump Version This adds a new "Bump Version" workflow for managing versioning and queuing new builds. When run, this workflow will bump the version, create a new tag, and push the changes to the target branch. There is a new dropdown when queuing the "Bump Version" workflow to select what kind of version bump to perform. A bump must always be performed when running a new build to ensure consistency. I had to create a GitHub App to grant write permissions to our main branch for the version bump commits. I've made a separate workflow file to manage the version bump commits, which should help prevent tampering. Thanks to using the GitHub API directly, I am able to make these commits signed! #### Build Helper Build Helper is now triggered when new tags are created, rather than being triggered automatically. This ensures we're always creating artifacts from known checkpoints. ### Settings Adds a new `autoupdate:channel` configuration to the settings file. If unset, the default from the artifact will be used (should correspond to the channel of the artifact when downloaded). ## Future Work I want to add a release workflow that will automatically copy over the corresponding version artifacts to the release bucket when a new GitHub Release is created. I also want to separate versions into separate subdirectories in the release bucket so we can clean them up more-easily. --------- Co-authored-by: wave-builder <builds@commandline.dev> Co-authored-by: wave-builder[bot] <181805596+wave-builder[bot]@users.noreply.github.com>
239 lines
7.9 KiB
YAML
239 lines
7.9 KiB
YAML
# Copyright 2024, Command Line Inc.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
version: "3"
|
|
|
|
vars:
|
|
APP_NAME: "TheNextWave"
|
|
BIN_DIR: "bin"
|
|
VERSION:
|
|
sh: node version.cjs
|
|
RM: '{{if eq OS "windows"}}cmd --% /c del /S{{else}}rm {{end}}'
|
|
RMRF: '{{if eq OS "windows"}}powershell Remove-Item -Force -Recurse{{else}}rm -rf{{end}}'
|
|
DATE: '{{if eq OS "windows"}}powershell Get-Date -UFormat{{else}}date{{end}}'
|
|
|
|
tasks:
|
|
electron:dev:
|
|
desc: Run the Electron application via the Vite dev server (enables hot reloading).
|
|
cmds:
|
|
- yarn dev
|
|
deps:
|
|
- yarn
|
|
- build:backend
|
|
env:
|
|
WCLOUD_ENDPOINT: "https://ot2e112zx5.execute-api.us-west-2.amazonaws.com/dev"
|
|
WCLOUD_WS_ENDPOINT: "wss://5lfzlg5crl.execute-api.us-west-2.amazonaws.com/dev/"
|
|
|
|
electron:start:
|
|
desc: Run the Electron application directly.
|
|
cmds:
|
|
- yarn start
|
|
deps:
|
|
- yarn
|
|
- build:backend
|
|
|
|
package:
|
|
desc: Package the application for the current platform.
|
|
cmds:
|
|
- cmd: '{{.RMRF}} "make"'
|
|
ignore_error: true
|
|
- yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never
|
|
deps:
|
|
- yarn
|
|
- build:backend
|
|
|
|
build:backend:
|
|
desc: Build the wavesrv and wsh components.
|
|
cmds:
|
|
- task: build:server
|
|
- task: build:wsh
|
|
|
|
build:server:
|
|
desc: Build the wavesrv component.
|
|
deps:
|
|
- generate
|
|
- build:server:linux
|
|
- build:server:macos
|
|
- build:server:windows
|
|
|
|
build:server:macos:
|
|
desc: Build the wavesrv component for macOS (Darwin) platforms (generates artifacts for both arm64 and amd64).
|
|
status:
|
|
- exit {{if eq OS "darwin"}}1{{else}}0{{end}}
|
|
cmds:
|
|
- cmd: "{{.RM}} dist/bin/wavesrv*"
|
|
ignore_error: true
|
|
- task: build:server:internal
|
|
vars:
|
|
ARCHS: arm64,amd64
|
|
|
|
build:server:windows:
|
|
desc: Build the wavesrv component for Windows platforms (only generates artifacts for the current architecture).
|
|
status:
|
|
- exit {{if eq OS "windows"}}1{{else}}0{{end}}
|
|
cmds:
|
|
- cmd: "{{.RM}} dist/bin/wavesrv*"
|
|
ignore_error: true
|
|
- task: build:server:internal
|
|
vars:
|
|
ARCHS:
|
|
sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
|
|
|
|
build:server:linux:
|
|
desc: Build the wavesrv component for Linux platforms (only generates artifacts for the current architecture).
|
|
status:
|
|
- exit {{if eq OS "linux"}}1{{else}}0{{end}}
|
|
cmds:
|
|
- cmd: "{{.RM}} dist/bin/wavesrv*"
|
|
ignore_error: true
|
|
- task: build:server:internal
|
|
vars:
|
|
ARCHS:
|
|
sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
|
|
GO_LDFLAGS: -linkmode 'external' -extldflags=-static
|
|
|
|
build:server:internal:
|
|
requires:
|
|
vars:
|
|
- ARCHS
|
|
cmds:
|
|
- cmd: CGO_ENABLED=1 GOARCH={{.GOARCH}} go build -tags "osusergo,netcgo,sqlite_omit_load_extension" -ldflags "{{.GO_LDFLAGS}} -X main.BuildTime=$({{.DATE}} +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wavesrv.{{if eq .GOARCH "amd64"}}x64{{else}}{{.GOARCH}}{{end}}{{exeExt}} cmd/server/main-server.go
|
|
for:
|
|
var: ARCHS
|
|
split: ","
|
|
as: GOARCH
|
|
sources:
|
|
- "cmd/server/*.go"
|
|
- "pkg/**/*.go"
|
|
generates:
|
|
- dist/bin/wavesrv.*{{exeExt}}
|
|
deps:
|
|
- go:mod:tidy
|
|
internal: true
|
|
|
|
build:wsh:
|
|
desc: Build the wsh component for all possible targets.
|
|
cmds:
|
|
- cmd: "{{.RM}} dist/bin/wsh*"
|
|
ignore_error: true
|
|
- 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
|
|
deps:
|
|
- generate
|
|
|
|
dev:installwsh:
|
|
desc: quick shortcut to rebuild wsh and install for macos arm64
|
|
requires:
|
|
vars:
|
|
- VERSION
|
|
cmds:
|
|
- task: build:wsh:internal
|
|
vars:
|
|
GOOS: darwin
|
|
GOARCH: arm64
|
|
- cp dist/bin/wsh-{{.VERSION}}-darwin.arm64 ~/.waveterm-dev/bin/wsh
|
|
|
|
build:wsh:internal:
|
|
vars:
|
|
EXT:
|
|
sh: echo {{if eq .GOOS "windows"}}.exe{{end}}
|
|
NORMALIZEDARCH:
|
|
sh: echo {{if eq .GOARCH "amd64"}}x64{{else}}{{.GOARCH}}{{end}}
|
|
requires:
|
|
vars:
|
|
- GOOS
|
|
- GOARCH
|
|
- VERSION
|
|
sources:
|
|
- "cmd/wsh/**/*.go"
|
|
- "pkg/**/*.go"
|
|
generates:
|
|
- dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.NORMALIZEDARCH}}{{.EXT}}
|
|
cmds:
|
|
- (CGO_ENABLED=0 GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -ldflags="-s -w -X main.BuildTime=$({{.DATE}} +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.NORMALIZEDARCH}}{{.EXT}} cmd/wsh/main-wsh.go)
|
|
deps:
|
|
- go:mod:tidy
|
|
internal: true
|
|
|
|
generate:
|
|
desc: Generate Typescript bindings for the Go backend.
|
|
cmds:
|
|
- go run cmd/generatets/main-generatets.go
|
|
- go run cmd/generatego/main-generatego.go
|
|
sources:
|
|
- "cmd/generatego/*.go"
|
|
- "cmd/generatets/*.go"
|
|
- "pkg/service/**/*.go"
|
|
- "pkg/waveobj/*.go"
|
|
- "pkg/wconfig/**/*.go"
|
|
- "pkg/wstore/*.go"
|
|
- "pkg/wshrpc/**/*.go"
|
|
- "pkg/tsgen/**/*.go"
|
|
- "pkg/gogen/**/*.go"
|
|
- "pkg/wconfig/**/*.go"
|
|
- "pkg/eventbus/eventbus.go"
|
|
generates:
|
|
- frontend/types/gotypes.d.ts
|
|
- pkg/wshrpc/wshclient/wshclient.go
|
|
- frontend/app/store/services.ts
|
|
- frontend/app/store/wshserver.ts
|
|
|
|
version:
|
|
desc: Get the current package version, or bump version if args are present.
|
|
summary: |
|
|
If no arguments are present, the current version will be returned.
|
|
If only a single argument is given, the following are valid inputs:
|
|
- `none`: No-op.
|
|
- `patch`: Bumps the patch version.
|
|
- `minor`: Bumps the minor version.
|
|
- `major`: Bumps the major version.
|
|
- '1', 'true': Bumps the prerelease version.
|
|
If two arguments are given, the first argument must be either `none`, `patch`, `minor`, or `major`. The second argument must be `1` or `true` to bump the prerelease version.
|
|
cmd: node version.cjs {{.CLI_ARGS}}
|
|
|
|
yarn:
|
|
desc: Runs `yarn`
|
|
internal: true
|
|
generates:
|
|
- node_modules/**/*
|
|
- yarn.lock
|
|
- .yarn/*
|
|
sources:
|
|
- yarn.lock
|
|
- package.json
|
|
- .yarnrc.yml
|
|
cmds:
|
|
- yarn
|
|
|
|
go:mod:tidy:
|
|
desc: Runs `go mod tidy`
|
|
internal: true
|
|
generates:
|
|
- go.sum
|
|
sources:
|
|
- go.mod
|
|
cmds:
|
|
- go mod tidy
|