move to codeberg (#1)

This commit is contained in:
T. von Dein
2025-12-16 20:43:46 +01:00
parent 541804e139
commit a91664c8c2
6 changed files with 140 additions and 6 deletions

65
.goreleaser.yaml Normal file
View File

@@ -0,0 +1,65 @@
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 2
before:
hooks:
- go mod tidy
gitea_urls:
api: https://codeberg.org/api/v1
download: https://codeberg.org
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- freebsd
archives:
- formats: [tar.gz]
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}_{{ .Tag }}
# use zip for windows archives
format_overrides:
- goos: windows
formats: [zip]
- goos: linux
formats: [tar.gz,binary]
files:
- src: "*.md"
strip_parent: true
- src: Makefile.dist
dst: Makefile
wrap_in_directory: true
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
groups:
- title: Improved
regexp: '^.*?(feat|add|new)(\([[:word:]]+\))??!?:.+$'
order: 0
- title: Fixed
regexp: '^.*?(bug|fix)(\([[:word:]]+\))??!?:.+$'
order: 1
- title: Changed
order: 999
release:
header: "# Release Notes"
footer: >-
---
Full Changelog: [{{ .PreviousTag }}...{{ .Tag }}](https://codeberg.org/scip/watson-starship/compare/{{ .PreviousTag }}...{{ .Tag }})

36
.woodpecker/build.yaml Normal file
View File

@@ -0,0 +1,36 @@
matrix:
platform:
- linux/amd64
goversion:
- 1.23
labels:
platform: ${platform}
steps:
build:
when:
event: [push]
image: golang:${goversion}
commands:
- go get
- go build
linter:
when:
event: [push]
image: golang:${goversion}
commands:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0
- golangci-lint --version
- golangci-lint run ./...
depends_on: [build]
# test:
# when:
# event: [push]
# image: golang:${goversion}
# commands:
# - go get
# - go test -v -cover
# depends_on: [build,linter]

15
.woodpecker/release.yaml Normal file
View File

@@ -0,0 +1,15 @@
# build release
labels:
platform: linux/amd64
steps:
goreleaser:
image: goreleaser/goreleaser
when:
event: [tag]
environment:
GITEA_TOKEN:
from_secret: DEPLOY_TOKEN
commands:
- goreleaser release --clean --verbose

18
Makefile.dist Normal file
View File

@@ -0,0 +1,18 @@
# -*-make-*-
.PHONY: install all
tool = rpn
PREFIX = /usr/local
UID = root
GID = 0
all:
@echo "Type 'sudo make install' to install the tool."
@echo "To change prefix, type 'sudo make install PREFIX=/opt'"
install:
install -d -o $(UID) -g $(GID) $(PREFIX)/bin
install -d -o $(UID) -g $(GID) $(PREFIX)/share/doc
install -o $(UID) -g $(GID) -m 555 $(tool) $(PREFIX)/sbin/
install -o $(UID) -g $(GID) -m 444 *.md $(PREFIX)/share/doc/

View File

@@ -17,7 +17,7 @@ command = "watson status -e | sed -e 's/ ago//' -e 's/ seconds/s/' -e 's/ minute
# use perl to parse the status file directly # use perl to parse the status file directly
command = 'perl -n -e "if (/start.: (\d+)/) { \$diff = (time - \$1) / 3600; printf \"%.02fh\n\", \$diff; }" < ~/.config/watson/state' command = 'perl -n -e "if (/start.: (\d+)/) { \$diff = (time - \$1) / 3600; printf \"%.02fh\n\", \$diff; }" < ~/.config/watson/state'
# use bash, date and https://github.com/TLINDEN/rpnc direclty on the status file # use bash, date and https://codeberg.org/scip/rpnc direclty on the status file
command = 'if [[ "$(grep start ~/.config/watson/state)" =~ ([0-9]+) ]]; then echo $(("$(date +%s)" - "${BASH_REMATCH[1]}")) 3600 / | rpn; fi' command = 'if [[ "$(grep start ~/.config/watson/state)" =~ ([0-9]+) ]]; then echo $(("$(date +%s)" - "${BASH_REMATCH[1]}")) 3600 / | rpn; fi'
``` ```
@@ -32,7 +32,7 @@ You'll need the Golang toolchain for this (version 1.23+).
To build: To build:
```shell ```shell
git clone https://github.com/TLINDEN/watson-starship.git git clone https://codeberg.org/scip/watson-starship.git
cd watson-starship cd watson-starship
make make
make install make install
@@ -57,7 +57,7 @@ best way for me to forget to do something.
In order to report a bug, unexpected behavior, feature requests or to In order to report a bug, unexpected behavior, feature requests or to
submit a patch, please open an issue on github: submit a patch, please open an issue on github:
https://github.com/TLINDEN/watson-starship/issues. https://codeberg.org/scip/watson-starship/issues.
## Copyright and license ## Copyright and license
@@ -69,7 +69,7 @@ T.v.Dein <tom AT vondein DOT org>
## Project homepage ## Project homepage
https://github.com/TLINDEN/watson-starship https://codeberg.org/scip/watson-starship
## Copyright and License ## Copyright and License

View File

@@ -36,12 +36,12 @@ func main() {
data, err := os.ReadFile(statsfile) data, err := os.ReadFile(statsfile)
if err != nil { if err != nil {
log.Fatalf("Could not read watson stats file: %w", err) log.Fatalf("Could not read watson stats file: %s", err)
} }
var stats Stats var stats Stats
if err = json.Unmarshal(data, &stats); err != nil { if err = json.Unmarshal(data, &stats); err != nil {
log.Fatalf("Could not unmarshal JSON: %w", err) log.Fatalf("Could not unmarshal JSON: %s", err)
} }
start := time.Unix(stats.Start, 0) start := time.Unix(stats.Start, 0)