feat(releaser): initial release v0.4.0
Complete GitFlow release automation tool for Conventional Commits workflows: - Core pipeline: branch parsing, tag discovery, commit analysis, version bump - Maven pom.xml read/write, git commit/tag, HTTPS push with token auth - GitLab release creation via API with auto-generated release notes - Configurable via .releaser.yml (tag_prefix, branch_pattern, commit_message, pom_path, gitlab) - CLI flags: --dry-run, --no-push, --no-commit, --tag-only, --branch, --pom, --tag-prefix, --branch-pattern - Dockerfile (multi-stage Alpine), .releaser.gitlab-ci.yml reusable template - Gitea CI (vet + staticcheck + test + build) and release (5-platform cross-compilation) workflows - Taskfile with build/test/cov/lint/fuzz/ci/docker tasks - 96% test coverage with real in-memory git repos and fuzz tests for all parsers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: vet, staticcheck, test, build
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: golang:1.26-alpine
|
||||
|
||||
steps:
|
||||
- name: Install tools
|
||||
run: apk add --no-cache git
|
||||
|
||||
- name: Checkout
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SERVER_URL: ${{ github.server_url }}
|
||||
REPO: ${{ github.repository }}
|
||||
REF: ${{ github.ref_name }}
|
||||
run: |
|
||||
git clone --depth 1 --branch "$REF" \
|
||||
"$(echo "$SERVER_URL" | sed "s|https://|https://oauth2:${TOKEN}@|")/${REPO}.git" .
|
||||
|
||||
- name: vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: staticcheck
|
||||
run: go tool staticcheck ./...
|
||||
|
||||
- name: test
|
||||
run: go test ./...
|
||||
|
||||
- name: build
|
||||
run: go build ./cmd/...
|
||||
@@ -0,0 +1,110 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Build and publish release
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: golang:1.26-alpine
|
||||
|
||||
steps:
|
||||
- name: Install tools
|
||||
run: apk add --no-cache curl git jq
|
||||
|
||||
- name: Checkout
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SERVER_URL: ${{ github.server_url }}
|
||||
REPO: ${{ github.repository }}
|
||||
REF: ${{ github.ref_name }}
|
||||
run: |
|
||||
git clone --depth 1 --branch "$REF" \
|
||||
"$(echo "$SERVER_URL" | sed "s|https://|https://oauth2:${TOKEN}@|")/${REPO}.git" .
|
||||
|
||||
- name: Build Linux (amd64)
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
CGO_ENABLED: "0"
|
||||
run: |
|
||||
go build -trimpath \
|
||||
-ldflags="-s -w -X main.version=${{ github.ref_name }}" \
|
||||
-o releaser-${{ github.ref_name }}-linux-amd64 \
|
||||
./cmd/...
|
||||
|
||||
- name: Build Linux (arm64)
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: arm64
|
||||
CGO_ENABLED: "0"
|
||||
run: |
|
||||
go build -trimpath \
|
||||
-ldflags="-s -w -X main.version=${{ github.ref_name }}" \
|
||||
-o releaser-${{ github.ref_name }}-linux-arm64 \
|
||||
./cmd/...
|
||||
|
||||
- name: Build macOS (amd64)
|
||||
env:
|
||||
GOOS: darwin
|
||||
GOARCH: amd64
|
||||
CGO_ENABLED: "0"
|
||||
run: |
|
||||
go build -trimpath \
|
||||
-ldflags="-s -w -X main.version=${{ github.ref_name }}" \
|
||||
-o releaser-${{ github.ref_name }}-darwin-amd64 \
|
||||
./cmd/...
|
||||
|
||||
- name: Build macOS (arm64)
|
||||
env:
|
||||
GOOS: darwin
|
||||
GOARCH: arm64
|
||||
CGO_ENABLED: "0"
|
||||
run: |
|
||||
go build -trimpath \
|
||||
-ldflags="-s -w -X main.version=${{ github.ref_name }}" \
|
||||
-o releaser-${{ github.ref_name }}-darwin-arm64 \
|
||||
./cmd/...
|
||||
|
||||
- name: Build Windows (amd64)
|
||||
env:
|
||||
GOOS: windows
|
||||
GOARCH: amd64
|
||||
CGO_ENABLED: "0"
|
||||
run: |
|
||||
go build -trimpath \
|
||||
-ldflags="-s -w -X main.version=${{ github.ref_name }}" \
|
||||
-o releaser-${{ github.ref_name }}-windows-amd64.exe \
|
||||
./cmd/...
|
||||
|
||||
- name: Create release and upload assets
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
API_URL: ${{ github.api_url }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
release_id=$(curl -sf -X POST \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
"$API_URL/repos/$REPO/releases" \
|
||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \
|
||||
| jq -r .id)
|
||||
|
||||
for file in \
|
||||
releaser-${TAG}-linux-amd64 \
|
||||
releaser-${TAG}-linux-arm64 \
|
||||
releaser-${TAG}-darwin-amd64 \
|
||||
releaser-${TAG}-darwin-arm64 \
|
||||
releaser-${TAG}-windows-amd64.exe; do
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
"$API_URL/repos/$REPO/releases/$release_id/assets?name=$file" \
|
||||
--data-binary "@$file"
|
||||
echo "uploaded: $file"
|
||||
done
|
||||
Reference in New Issue
Block a user