feat(ci): first attempt for automated releases

This commit is contained in:
Simon Cornet 2025-04-03 11:09:09 +02:00
commit edd4999b73
4 changed files with 67 additions and 2 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
/gogitlabber /gogitlabber
# Added by goreleaser init:
dist/

View file

@ -29,3 +29,16 @@ build:
name: "${CI_PROJECT_NAME}" name: "${CI_PROJECT_NAME}"
paths: paths:
- "gogitlabber" - "gogitlabber"
release:
stage: "release"
needs:
- "build"
image:
name: "goreleaser/goreleaser:v2.8.2"
entrypoint: [""]
rules:
- if: "$CI_COMMIT_TAG"
script:
- export GITLAB_TOKEN="$GORELEASER_GITLAB_TOKEN"
- "goreleaser release --rm-dist --changelog=changelog.md"

52
.goreleaser.yaml Normal file
View file

@ -0,0 +1,52 @@
---
version: 2
# before
before:
hooks:
- "go mod tidy"
- "go generate ./..."
# build
builds:
- id: "gogitlabber"
binary: "gogitlabber"
main: "./cmd/gogitlabber"
env:
- "CGO_ENABLED=0"
goarch:
- "amd64"
- "arm64"
goos:
- "linux"
- "windows"
- "darwin"
# archives
archives:
- formats: ["tar.gz"]
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 }}
# use zip for windows archives
format_overrides:
- goos: "windows"
formats: ["zip"]
# changelog
changelog:
use: "git"
sort: "desc"
filters:
exclude:
- "^chore(?:\\([^)]+\\))?:"
- "^ci(?:\\([^)]+\\))?:"
- "^docs(?:\\([^)]+\\))?:"
groups:
- title: "🚀 Features"
regexp: "^feat(?:\\([^)]+\\))?:"
- title: "🐛 Bug Fixes"
regexp: "^fix(?:\\([^)]+\\))?:"
- title: "🛠 Maintenance"
regexp: "^(chore|refactor)"

2
go.sum
View file

@ -16,8 +16,6 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/schollz/progressbar/v3 v3.18.0 h1:uXdoHABRFmNIjUfte/Ex7WtuyVslrw2wVPQmCN62HpA= github.com/schollz/progressbar/v3 v3.18.0 h1:uXdoHABRFmNIjUfte/Ex7WtuyVslrw2wVPQmCN62HpA=
github.com/schollz/progressbar/v3 v3.18.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec= github.com/schollz/progressbar/v3 v3.18.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=
github.com/scornet256/go-logger v0.0.0-20250306110019-822a77b239f9 h1:oHcJkJ1kyptkzoiyplglByhjk3DOt6EVllMeS/00hSI=
github.com/scornet256/go-logger v0.0.0-20250306110019-822a77b239f9/go.mod h1:GptTzXTPlyNj2mZjhRyWfmP4EDb1Ca2osDpooBy6MmI=
github.com/scornet256/go-logger v0.0.0-20250306113004-0062c214ab34 h1:icrxu4GofO9DYa4Qb06OLvaLbs/eZGQJLFQz35fQ9cQ= github.com/scornet256/go-logger v0.0.0-20250306113004-0062c214ab34 h1:icrxu4GofO9DYa4Qb06OLvaLbs/eZGQJLFQz35fQ9cQ=
github.com/scornet256/go-logger v0.0.0-20250306113004-0062c214ab34/go.mod h1:GptTzXTPlyNj2mZjhRyWfmP4EDb1Ca2osDpooBy6MmI= github.com/scornet256/go-logger v0.0.0-20250306113004-0062c214ab34/go.mod h1:GptTzXTPlyNj2mZjhRyWfmP4EDb1Ca2osDpooBy6MmI=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=