Skip to content

Commit 098b72c

Browse files
committed
fix linting and add goreleaser
1 parent a4057f1 commit 098b72c

File tree

3 files changed

+167
-14
lines changed

3 files changed

+167
-14
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
12+
jobs:
13+
goreleaser:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: '1.24'
25+
26+
- name: Set up Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
cache: 'npm'
31+
cache-dependency-path: frontend/package-lock.json
32+
33+
- name: Install build tools
34+
run: |
35+
go mod download
36+
go install github.com/swaggo/swag/cmd/swag@latest
37+
38+
- name: Generate Swagger docs
39+
run: swag init -g cmd/server/main.go -o docs
40+
41+
- name: Run GoReleaser
42+
uses: goreleaser/goreleaser-action@v6
43+
with:
44+
distribution: goreleaser
45+
version: latest
46+
args: release --clean
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# GoReleaser configuration for darb
2+
version: 2
3+
4+
before:
5+
hooks:
6+
# Build frontend before creating release
7+
- cd frontend && npm install && npm run build
8+
9+
builds:
10+
- id: darb
11+
main: ./cmd/server
12+
binary: darb
13+
env:
14+
- CGO_ENABLED=0
15+
goos:
16+
- linux
17+
- darwin
18+
goarch:
19+
- amd64
20+
- arm64
21+
ldflags:
22+
- -s -w
23+
- -X main.version={{.Version}}
24+
- -X main.commit={{.Commit}}
25+
- -X main.date={{.Date}}
26+
# Include frontend dist files in the binary directory
27+
hooks:
28+
post:
29+
- sh -c "mkdir -p dist/{{.ProjectName}}_{{.Os}}_{{.Arch}}_{{.Arm}}/frontend && cp -r frontend/dist dist/{{.ProjectName}}_{{.Os}}_{{.Arch}}_{{.Arm}}/frontend/"
30+
31+
archives:
32+
- id: darb
33+
name_template: >-
34+
{{ .ProjectName }}_{{ .Version }}_
35+
{{- if eq .Os "darwin" }}macOS
36+
{{- else }}{{ .Os }}{{ end }}_
37+
{{- if eq .Arch "amd64" }}x86_64
38+
{{- else }}{{ .Arch }}{{ end }}
39+
files:
40+
- LICENSE*
41+
- README*
42+
- CHANGELOG*
43+
- frontend/dist/**/*
44+
45+
checksum:
46+
name_template: 'checksums.txt'
47+
algorithm: sha256
48+
49+
snapshot:
50+
version_template: "{{ incpatch .Version }}-next"
51+
52+
changelog:
53+
sort: asc
54+
use: github
55+
filters:
56+
exclude:
57+
- '^docs:'
58+
- '^test:'
59+
- '^chore:'
60+
- typo
61+
- Merge pull request
62+
- Merge branch
63+
groups:
64+
- title: 'New Features'
65+
regexp: "^.*feat[(\\w)]*:+.*$"
66+
order: 0
67+
- title: 'Bug Fixes'
68+
regexp: "^.*fix[(\\w)]*:+.*$"
69+
order: 1
70+
- title: 'Enhancements'
71+
regexp: "^.*enhancement[(\\w)]*:+.*$"
72+
order: 2
73+
- title: 'Others'
74+
order: 999
75+
76+
release:
77+
github:
78+
owner: aktech
79+
name: darb
80+
draft: false
81+
prerelease: auto
82+
mode: replace
83+
header: |
84+
## darb {{ .Tag }} ({{ .Date }})
85+
86+
Welcome to this new release of darb!
87+
footer: |
88+
## Installation
89+
90+
### Binary Installation
91+
92+
Download the appropriate binary for your platform from the assets below.
93+
94+
### Docker
95+
96+
```bash
97+
docker pull ghcr.io/aktech/darb:{{ .Tag }}
98+
```
99+
100+
---
101+
102+
**Full Changelog**: https://github.com/aktech/darb/compare/{{ .PreviousTag }}...{{ .Tag }}
103+
104+
announce:
105+
skip: true

internal/models/environment_version.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ import (
99

1010
// EnvironmentVersion represents a snapshot of environment files at a point in time
1111
type EnvironmentVersion struct {
12-
ID uuid.UUID `gorm:"type:text;primary_key" json:"id"`
13-
EnvironmentID uuid.UUID `gorm:"type:text;not null;index:idx_env_version" json:"environment_id"`
14-
Environment Environment `gorm:"foreignKey:EnvironmentID" json:"environment,omitempty"`
12+
ID uuid.UUID `gorm:"type:text;primary_key" json:"id"`
13+
EnvironmentID uuid.UUID `gorm:"type:text;not null;index:idx_env_version" json:"environment_id"`
14+
Environment Environment `gorm:"foreignKey:EnvironmentID" json:"environment,omitempty"`
1515

1616
// Version tracking
17-
VersionNumber int `gorm:"not null;index:idx_env_version" json:"version_number"` // Auto-incrementing per environment
17+
VersionNumber int `gorm:"not null;index:idx_env_version" json:"version_number"` // Auto-incrementing per environment
1818

1919
// File contents (stored as TEXT in database)
20-
LockFileContent string `gorm:"type:text;not null" json:"lock_file_content"` // pixi.lock content
21-
ManifestContent string `gorm:"type:text;not null" json:"manifest_content"` // pixi.toml content
22-
PackageMetadata string `gorm:"type:text;not null" json:"package_metadata"` // JSON of package list
20+
LockFileContent string `gorm:"type:text;not null" json:"lock_file_content"` // pixi.lock content
21+
ManifestContent string `gorm:"type:text;not null" json:"manifest_content"` // pixi.toml content
22+
PackageMetadata string `gorm:"type:text;not null" json:"package_metadata"` // JSON of package list
2323

2424
// Context
25-
JobID *uuid.UUID `gorm:"type:text;index" json:"job_id,omitempty"` // Job that triggered this version
26-
Job *Job `gorm:"foreignKey:JobID" json:"job,omitempty"`
27-
CreatedBy uuid.UUID `gorm:"type:text;not null" json:"created_by"` // User who triggered the change
28-
CreatedByUser User `gorm:"foreignKey:CreatedBy" json:"created_by_user,omitempty"`
29-
Description string `gorm:"type:text" json:"description,omitempty"` // Optional description of changes
25+
JobID *uuid.UUID `gorm:"type:text;index" json:"job_id,omitempty"` // Job that triggered this version
26+
Job *Job `gorm:"foreignKey:JobID" json:"job,omitempty"`
27+
CreatedBy uuid.UUID `gorm:"type:text;not null" json:"created_by"` // User who triggered the change
28+
CreatedByUser User `gorm:"foreignKey:CreatedBy" json:"created_by_user,omitempty"`
29+
Description string `gorm:"type:text" json:"description,omitempty"` // Optional description of changes
3030

3131
// Timestamps
32-
CreatedAt time.Time `json:"created_at"`
33-
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
32+
CreatedAt time.Time `json:"created_at"`
33+
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
3434
}
3535

3636
// BeforeCreate hook to generate UUID and version number

0 commit comments

Comments
 (0)