Skip to content

Commit 8c97cef

Browse files
committed
ci: process releases on codeberg.org
1 parent fab88f9 commit 8c97cef

File tree

8 files changed

+150
-197
lines changed

8 files changed

+150
-197
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 183 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ docs/user/reference/cli/*.md
3535
!.github/
3636
!.woodpecker/
3737
!.gitignore
38-
!.goreleaser.yml
38+
!.goreleaser.yaml
3939
!docs/user/.vitepress/
4040

4141
# Temporary files

.goreleaser.yml renamed to .goreleaser.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ snapshot:
5656

5757
changelog:
5858
sort: asc
59-
use: github
59+
use: gitea
6060
filters:
6161
exclude:
6262
- '^docs:'
@@ -79,16 +79,17 @@ changelog:
7979
order: 999
8080

8181
release:
82-
github:
82+
gitea:
8383
owner: orien
8484
name: stackaroo
85-
draft: false
86-
prerelease: auto
8785
mode: replace
88-
8986
footer: |
9087
**Full Changelog**: https://codeberg.org/orien/stackaroo/compare/{{.PreviousTag}}...{{.Tag}}
9188
89+
gitea_urls:
90+
api: https://codeberg.org/api/v1/
91+
download: https://codeberg.org
92+
9293
git:
9394
ignore_tags:
9495
- '*-rc*'

.woodpecker/release.yaml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
when:
2+
- event: tag
3+
tag: v*
4+
5+
steps:
6+
test:
7+
image: golang:1-alpine
8+
commands:
9+
- apk add --no-cache git make
10+
- make tidy
11+
- |
12+
if [ -n "$(git status --porcelain)" ]; then
13+
echo "Go mod tidy changed files"
14+
git diff
15+
exit 1
16+
fi
17+
- make test
18+
19+
lint:
20+
image: golang:1-alpine
21+
commands:
22+
- apk add --no-cache git make
23+
- make install-golangci-lint
24+
- make lint
25+
26+
security:
27+
image: golang:1-alpine
28+
commands:
29+
- apk add --no-cache git make
30+
- go install golang.org/x/vuln/cmd/govulncheck@latest
31+
- govulncheck ./...
32+
33+
validate-tag:
34+
image: alpine:latest
35+
commands:
36+
- apk add --no-cache bash
37+
- |
38+
TAG="${CI_COMMIT_TAG}"
39+
echo "Release tag: $TAG"
40+
41+
# Validate tag format (should be v*.*.* or similar)
42+
if ! echo "$TAG" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)*$'; then
43+
echo "❌ Invalid tag format: $TAG"
44+
echo "Expected format: v1.2.3 or v1.2.3-rc1"
45+
exit 1
46+
fi
47+
48+
echo "✅ Tag format is valid: $TAG"
49+
50+
check-version:
51+
image: alpine:latest
52+
depends_on: [validate-tag]
53+
commands:
54+
- apk add --no-cache bash
55+
- |
56+
TAG="${CI_COMMIT_TAG}"
57+
VERSION_FROM_FILE=$(cat VERSION)
58+
VERSION_FROM_TAG="${TAG#v}"
59+
60+
echo "Tag version: $VERSION_FROM_TAG"
61+
echo "VERSION file: $VERSION_FROM_FILE"
62+
63+
# Extract major version from tag
64+
MAJOR_VERSION=$(echo "$VERSION_FROM_TAG" | grep -oE '^[0-9]+\.[0-9]+\.[0-9]+')
65+
66+
if [ -n "$MAJOR_VERSION" ]; then
67+
if [ "$VERSION_FROM_FILE" != "$MAJOR_VERSION" ]; then
68+
echo "⚠️ Warning: VERSION file ($VERSION_FROM_FILE) doesn't match tag version ($MAJOR_VERSION)"
69+
echo "This is acceptable for pre-release tags, but should be updated for final releases."
70+
else
71+
echo "✅ VERSION file matches tag version"
72+
fi
73+
fi
74+
75+
goreleaser:
76+
image: goreleaser/goreleaser:latest
77+
depends_on: [test, lint, security, validate-tag, check-version]
78+
secrets: [codeberg_token]
79+
environment:
80+
- GITEA_TOKEN=${CODEBERG_RELEASE_TOKEN}
81+
commands:
82+
- |
83+
# Create .goreleaser.yml if it doesn't exist for Codeberg/Gitea
84+
if [ ! -f .goreleaser.yml ]; then
85+
echo "Creating default .goreleaser.yml for Gitea/Codeberg"
86+
cat > .goreleaser.yml <<'EOF'
87+
project_name: stackaroo
88+
89+
before:
90+
hooks:
91+
- go mod tidy
92+
93+
builds:
94+
- env:
95+
- CGO_ENABLED=0
96+
goos:
97+
- linux
98+
- windows
99+
- darwin
100+
goarch:
101+
- amd64
102+
- arm64
103+
ldflags:
104+
- -s -w
105+
- -X codeberg.org/orien/stackaroo/internal/version.Version={{.Version}}
106+
- -X codeberg.org/orien/stackaroo/internal/version.GitCommit={{.ShortCommit}}
107+
- -X codeberg.org/orien/stackaroo/internal/version.BuildDate={{.Date}}
108+
109+
archives:
110+
- format: tar.gz
111+
name_template: >-
112+
{{ .ProjectName }}_
113+
{{- .Version }}_
114+
{{- title .Os }}_
115+
{{- if eq .Arch "amd64" }}x86_64
116+
{{- else if eq .Arch "386" }}i386
117+
{{- else }}{{ .Arch }}{{ end }}
118+
format_overrides:
119+
- goos: windows
120+
format: zip
121+
122+
checksum:
123+
name_template: 'checksums.txt'
124+
125+
gitea_urls:
126+
api: https://codeberg.org/api/v1/
127+
download: https://codeberg.org
128+
129+
release:
130+
gitea:
131+
owner: orien
132+
name: stackaroo
133+
EOF
134+
fi
135+
- goreleaser release --clean

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,15 @@ go install codeberg.org/orien/stackaroo@latest
186186

187187
### Download Binary
188188

189-
Download the latest release from the [releases page](https://github.com/orien/stackaroo/releases).
189+
Download the latest release from the [releases page](https://codeberg.org/orien/stackaroo/releases).
190190

191191
#### Linux/macOS
192192

193193
```bash
194194
# Download and install (replace VERSION and ARCH as needed)
195195
VERSION=1.0.0
196196
ARCH=linux-x86_64
197-
URL="https://github.com/orien/stackaroo/releases/download/v${VERSION}/stackaroo-${VERSION}-${ARCH}.tar.gz"
197+
URL="https://codeberg.org/orien/stackaroo/releases/download/v${VERSION}/stackaroo-${VERSION}-${ARCH}.tar.gz"
198198
DIR="stackaroo-${VERSION}-${ARCH}"
199199
200200
curl -sL "$URL" | tar -xz

0 commit comments

Comments
 (0)