tsk-1: Go version bump (#2)

Closes #1

Reviewed-on: #2
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2025-11-24 20:57:32 +00:00
committed by phoenix
parent ce7ccc8225
commit 2b14cdf7f6
6 changed files with 102 additions and 2 deletions
+44
View File
@@ -0,0 +1,44 @@
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-24.04 # You can change this to macos-latest or windows-latest if needed
steps:
- uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25.4' # You can specify a specific version or 'stable'
- name: Build
run: |
echo "Initializing config"
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender_models_deploy_key
chmod 600 ~/.ssh/textsender_models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender_models_deploy_key
go env -w GOPRIVATE='${{ secrets.GIT_HOST_ROOT }}'
echo "Creating local .gitconfig"
touch ~/.gitconfig
cat > ~/.gitconfig << "EOF"
[url "ssh://git@${{ secrets.GIT_HOST_ROOT }}"]
insteadOf = https://${{ secrets.GIT_HOST_ROOT }}
EOF
make build
- name: Test
run: go test -v ./...
+21
View File
@@ -0,0 +1,21 @@
VERSION ?= $(shell git describe --tags 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD)
BUILD_TIME ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
GO_VERSION ?= $(shell go version | awk '{print $$3}')
.PHONY: build
build:
go build -ldflags="\
-X 'git.kundeng.us/phoenix/catapult/version.Version=$(VERSION)' \
-X 'git.kundeng.us/phoenix/catapult/version.BuildTime=$(BUILD_TIME)' \
-X 'git.kundeng.us/phoenix/catapult/version.Commit=$(COMMIT)' \
-X 'git.kundeng.us/phoenix/catapult/version.GoVersion=$(GO_VERSION)'" \
-o catapult main.go
.PHONY: install
install:
go install -ldflags="\
-X 'git.kundeng.us/phoenix/catapult/version.Version=$(VERSION)' \
-X 'git.kundeng.us/phoenix/catapult/version.BuildTime=$(BUILD_TIME)' \
-X 'git.kundeng.us/phoenix/catapult/version.Commit=$(COMMIT)' \
-X 'git.kundeng.us/phoenix/catapult/version.GoVersion=$(GO_VERSION)'"
+6
View File
@@ -1,2 +1,8 @@
# Catapult
A service used to send text messages
Building the service
```
make build
```
+1 -1
View File
@@ -1,3 +1,3 @@
module git.kundeng.us/phoenix/catapult
go 1.25.3
go 1.25.4
+17
View File
@@ -0,0 +1,17 @@
package version
import "fmt"
var (
Version = "dev"
BuildTime = "unknown"
Commit = "unknown"
GoVersion = "unknown"
)
func String() string {
return fmt.Sprintf(
"Version: %s\nBuild Date: %s\nCommit: %s\nGo Version: %s",
Version, BuildTime, Commit, GoVersion,
)
}
+13 -1
View File
@@ -1,10 +1,22 @@
package main
import (
"flag"
"fmt"
"git.kundeng.us/phoenix/catapult/internal/version"
)
const App_Name = "catapult"
func main() {
fmt.Println("catapult")
fmt.Println(App_Name)
versionFlag := flag.Bool("version", false, "Print version information")
flag.Parse()
if *versionFlag {
fmt.Println(version.String())
return
}
}