Skip to content

Commit

Permalink
Improve gorelease process (owenthereal#227)
Browse files Browse the repository at this point in the history
* Improve gorelease

* Ignore `bin`
owenthereal authored Feb 3, 2024
1 parent 0855a34 commit f3d09b2
Showing 28 changed files with 100 additions and 89 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,3 +5,4 @@ release
*.tfstate
*.tfstate.backup
dist
bin
50 changes: 34 additions & 16 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- "386"
- "amd64"
- "arm"
- "arm64"
main: ./cmd/upterm
archives:
- format: tar.gz
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
name_template: '{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
wrap_in_directory: false
files:
- LICENSE*
- README*
- etc/*
- LICENSE
- README.md
- docs/*
brews:
- tap:
@@ -25,26 +27,42 @@ brews:
name: Owen Ou
email: o@owenou.com
homepage: https://upterm.dev
description: Secure terminal sharing
description: Instant Terminal Sharing
folder: Formula
license: "Apache 2.0"
custom_block: |
head "https://github.com/owenthereal/upterm.git"
install: |
bin.install "upterm"
prefix.install_metafiles
bash_completion.install "etc/completion/upterm.bash_completion.sh"
zsh_completion.install "etc/completion/upterm.zsh_completion" => "_upterm"
man.install "etc/man/man1"
man1.install Dir["etc/man/man1/upterm*.1"]
generate_completions_from_executable(bin/"upterm", "completion")
test: |
assert_match(/Upterm version/, shell_output("#{bin}/upterm version"))
checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
name_template: "{{ incpatch .Version }}-snapshot"
release:
prerelease: auto
name_template: "Upterm {{.Version}}"
mode: append
changelog:
sort: asc
use: github
filters:
exclude:
- '^docs:'
- '^test:'
- "^docs:"
- "^script:"
- "^go.mod:"
- "^.github:"
- Merge branch
nfpms: #build:linux
- license: Apache-2.0
maintainer: Owen Ou <o@owenou.com>
homepage: https://github.com/owenthereal/upterm
bindir: /usr
description: Instant Terminal Sharing
file_name_template: '{{ .PackageName }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
formats:
- deb
- rpm
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,55 @@
SHELL=/bin/bash -o pipefail

.PHONY: docs build proto client install test vet chart
BIN_DIR ?= $(CURDIR)/bin
export PATH := $(BIN_DIR):$(PATH)

.PHONY: tools
tools:
rm -rf $(BIN_DIR) && mkdir -p $(BIN_DIR)
# goreleaser
GOBIN=$(BIN_DIR) go install github.com/goreleaser/goreleaser@latest

.PHONY: generate
generate: proto

.PHONY: docs
docs:
rm -rf docs && mkdir docs
rm -rf etc && mkdir -p etc/man/man1 && mkdir -p etc/completion
go run cmd/gendoc/main.go

.PHONY: proto
proto:
docker run -v $(CURDIR)/server:/defs namely/protoc-all -f server.proto -l go --go-source-relative -o .
docker run -v $(CURDIR)/host/api:/defs namely/protoc-all -f api.proto -l go --go-source-relative -o .

.PHONY: build
build:
go build -o build/upterm ./cmd/upterm
go build -o build/uptermd ./cmd/uptermd
go build -o $(BIN_DIR)/upterm ./cmd/upterm
go build -o $(BIN_DIR)/uptermd ./cmd/uptermd

.PHONY: install
install:
go install ./cmd/...

TAG ?= latest
.PHONY: docker_build
docker_build:
docker build -t ghcr.io/owenthereal/upterm/uptermd:$(TAG) -f Dockerfile.uptermd .

.PHONY: docker_push
docker_push: docker_build
docker push ghcr.io/owenthereal/upterm/uptermd:$(TAG)

GO_TEST_FLAGS ?= ""
.PHONY: test
test:
go test ./... -timeout=120s -coverprofile=c.out -covermode=atomic -count=1 -race -v $(GO_TEST_FLAGS)

.PHONY: vet
vet:
docker run --rm -v $(CURDIR):/app:z -w /app golangci/golangci-lint:latest golangci-lint run -v --timeout 15m

.PHONY: goreleaser
goreleaser:
goreleaser release --clean --snapshot --skip=publish
2 changes: 1 addition & 1 deletion docs/upterm.md
Original file line number Diff line number Diff line change
@@ -38,4 +38,4 @@ Upterm is an open-source solution for sharing terminal sessions instantly over s
* [upterm upgrade](upterm_upgrade.md) - Upgrade the CLI
* [upterm version](upterm_version.md) - Show version

###### Auto generated by spf13/cobra on 9-Oct-2023
###### Auto generated by spf13/cobra on 3-Feb-2024
2 changes: 1 addition & 1 deletion docs/upterm_host.md
Original file line number Diff line number Diff line change
@@ -56,4 +56,4 @@ upterm host [flags]

* [upterm](upterm.md) - Instant Terminal Sharing

###### Auto generated by spf13/cobra on 9-Oct-2023
###### Auto generated by spf13/cobra on 3-Feb-2024
2 changes: 1 addition & 1 deletion docs/upterm_proxy.md
Original file line number Diff line number Diff line change
@@ -30,4 +30,4 @@ upterm proxy [flags]

* [upterm](upterm.md) - Instant Terminal Sharing

###### Auto generated by spf13/cobra on 9-Oct-2023
###### Auto generated by spf13/cobra on 3-Feb-2024
2 changes: 1 addition & 1 deletion docs/upterm_session.md
Original file line number Diff line number Diff line change
@@ -15,4 +15,4 @@ Display session
* [upterm session info](upterm_session_info.md) - Display terminal session by name
* [upterm session list](upterm_session_list.md) - List shared sessions

###### Auto generated by spf13/cobra on 9-Oct-2023
###### Auto generated by spf13/cobra on 3-Feb-2024
2 changes: 1 addition & 1 deletion docs/upterm_session_current.md
Original file line number Diff line number Diff line change
@@ -33,4 +33,4 @@ upterm session current [flags]

* [upterm session](upterm_session.md) - Display session

###### Auto generated by spf13/cobra on 9-Oct-2023
###### Auto generated by spf13/cobra on 3-Feb-2024
2 changes: 1 addition & 1 deletion docs/upterm_session_info.md
Original file line number Diff line number Diff line change
@@ -27,4 +27,4 @@ upterm session info [flags]

* [upterm session](upterm_session.md) - Display session

###### Auto generated by spf13/cobra on 9-Oct-2023
###### Auto generated by spf13/cobra on 3-Feb-2024
2 changes: 1 addition & 1 deletion docs/upterm_session_list.md
Original file line number Diff line number Diff line change
@@ -27,4 +27,4 @@ upterm session list [flags]

* [upterm session](upterm_session.md) - Display session

###### Auto generated by spf13/cobra on 9-Oct-2023
###### Auto generated by spf13/cobra on 3-Feb-2024
2 changes: 1 addition & 1 deletion docs/upterm_upgrade.md
Original file line number Diff line number Diff line change
@@ -26,4 +26,4 @@ upterm upgrade [flags]

* [upterm](upterm.md) - Instant Terminal Sharing

###### Auto generated by spf13/cobra on 9-Oct-2023
###### Auto generated by spf13/cobra on 3-Feb-2024
2 changes: 1 addition & 1 deletion docs/upterm_version.md
Original file line number Diff line number Diff line change
@@ -16,4 +16,4 @@ upterm version [flags]

* [upterm](upterm.md) - Instant Terminal Sharing

###### Auto generated by spf13/cobra on 9-Oct-2023
###### Auto generated by spf13/cobra on 3-Feb-2024
2 changes: 1 addition & 1 deletion etc/completion/upterm.bash_completion.sh
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ __upterm_handle_go_custom_completion()
local out requestComp lastParam lastChar comp directive args

# Prepare the command to request completions for the program.
# Calling ${words[0]} instead of directly upterm allows to handle aliases
# Calling ${words[0]} instead of directly upterm allows handling aliases
args=("${words[@]:1}")
# Disable ActiveHelp which is not supported for bash completion v1
requestComp="UPTERM_ACTIVE_HELP=0 ${words[0]} __completeNoDesc ${args[*]}"
12 changes: 4 additions & 8 deletions etc/man/man1/upterm-host.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nh
.TH "UPTERM" "1" "Oct 2023" "Upterm 0.13.0" "Upterm Manual"
.TH "UPTERM" "1" "Feb 2024" "Upterm 0.13.0" "Upterm Manual"

.SH NAME
.PP
@@ -67,10 +67,7 @@ private key. To authorize client connections, specify a authorized_key file with


.SH EXAMPLE
.PP
.RS

.nf
.EX
# Host a terminal session running $SHELL, attaching client's IO to the host's:
upterm host
@@ -89,8 +86,7 @@ private key. To authorize client connections, specify a authorized_key file with
# Use a different Uptermd server, hosting a session via WebSocket:
upterm host --server wss://YOUR_UPTERMD_SERVER -- YOUR_COMMAND
.fi
.RE
.EE


.SH SEE ALSO
@@ -100,4 +96,4 @@ private key. To authorize client connections, specify a authorized_key file with

.SH HISTORY
.PP
9-Oct-2023 Auto generated by spf13/cobra
3-Feb-2024 Auto generated by spf13/cobra
12 changes: 4 additions & 8 deletions etc/man/man1/upterm-proxy.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nh
.TH "UPTERM" "1" "Oct 2023" "Upterm 0.13.0" "Upterm Manual"
.TH "UPTERM" "1" "Feb 2024" "Upterm 0.13.0" "Upterm Manual"

.SH NAME
.PP
@@ -23,18 +23,14 @@ Proxy a terminal session via WebSocket, to be used alongside SSH ProxyCommand.


.SH EXAMPLE
.PP
.RS

.nf
.EX
# Host shares a session running $SHELL over WebSocket:
upterm host --server wss://uptermd.upterm.dev -- YOUR_COMMAND
# Client connects to the host session via WebSocket:
ssh -o ProxyCommand='upterm proxy wss://TOKEN@uptermd.upterm.dev' TOKEN:uptermd.uptermd.dev:443
.fi
.RE
.EE


.SH SEE ALSO
@@ -44,4 +40,4 @@ Proxy a terminal session via WebSocket, to be used alongside SSH ProxyCommand.

.SH HISTORY
.PP
9-Oct-2023 Auto generated by spf13/cobra
3-Feb-2024 Auto generated by spf13/cobra
12 changes: 4 additions & 8 deletions etc/man/man1/upterm-session-current.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nh
.TH "UPTERM" "1" "Oct 2023" "Upterm 0.13.0" "Upterm Manual"
.TH "UPTERM" "1" "Feb 2024" "Upterm 0.13.0" "Upterm Manual"

.SH NAME
.PP
@@ -29,18 +29,14 @@ sharing a session with 'upterm host'.


.SH EXAMPLE
.PP
.RS

.nf
.EX
# Display the active session as defined in $UPTERM_ADMIN_SOCKET:
upterm session current
# Display the session with a custom admin socket path:
upterm session current --admin-socket ADMIN_SOCKET_PATH
.fi
.RE
.EE


.SH SEE ALSO
@@ -50,4 +46,4 @@ sharing a session with 'upterm host'.

.SH HISTORY
.PP
9-Oct-2023 Auto generated by spf13/cobra
3-Feb-2024 Auto generated by spf13/cobra
12 changes: 4 additions & 8 deletions etc/man/man1/upterm-session-info.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nh
.TH "UPTERM" "1" "Oct 2023" "Upterm 0.13.0" "Upterm Manual"
.TH "UPTERM" "1" "Feb 2024" "Upterm 0.13.0" "Upterm Manual"

.SH NAME
.PP
@@ -23,15 +23,11 @@ Display terminal session by name.


.SH EXAMPLE
.PP
.RS

.nf
.EX
# Display session by name:
upterm session info NAME
.fi
.RE
.EE


.SH SEE ALSO
@@ -41,4 +37,4 @@ Display terminal session by name.

.SH HISTORY
.PP
9-Oct-2023 Auto generated by spf13/cobra
3-Feb-2024 Auto generated by spf13/cobra
12 changes: 4 additions & 8 deletions etc/man/man1/upterm-session-list.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nh
.TH "UPTERM" "1" "Oct 2023" "Upterm 0.13.0" "Upterm Manual"
.TH "UPTERM" "1" "Feb 2024" "Upterm 0.13.0" "Upterm Manual"

.SH NAME
.PP
@@ -23,15 +23,11 @@ List shared sessions. Session admin sockets are located in ~/.upterm.


.SH EXAMPLE
.PP
.RS

.nf
.EX
# List shared sessions:
upterm session list
.fi
.RE
.EE


.SH SEE ALSO
@@ -41,4 +37,4 @@ List shared sessions. Session admin sockets are located in ~/.upterm.

.SH HISTORY
.PP
9-Oct-2023 Auto generated by spf13/cobra
3-Feb-2024 Auto generated by spf13/cobra
4 changes: 2 additions & 2 deletions etc/man/man1/upterm-session.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nh
.TH "UPTERM" "1" "Oct 2023" "Upterm 0.13.0" "Upterm Manual"
.TH "UPTERM" "1" "Feb 2024" "Upterm 0.13.0" "Upterm Manual"

.SH NAME
.PP
@@ -29,4 +29,4 @@ Display session

.SH HISTORY
.PP
9-Oct-2023 Auto generated by spf13/cobra
3-Feb-2024 Auto generated by spf13/cobra
Loading
Oops, something went wrong.

0 comments on commit f3d09b2

Please sign in to comment.