From e28434a03027f9aef914e9bb78a19a88fc746ce0 Mon Sep 17 00:00:00 2001 From: k3nny Date: Thu, 24 Sep 2026 22:38:17 +0200 Subject: [PATCH] ci(github): add GitHub Actions CI and release workflows for k3nnyfr/releaser mirror - .github/workflows/ci.yml: same vet/staticcheck/test/build checks as Gitea CI - .github/workflows/release.yml: same five binaries and build flags as the Gitea release workflow, published with gh release create - docs: mention the GitHub mirror and both release pages; GitHub Actions example downloads from GitHub releases using RUNNER_OS/RUNNER_ARCH - docs: fix broken latest/download URL, clone URL and Go version requirement Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/ci.yml | 36 +++++++++++++++++++++ .github/workflows/release.yml | 57 ++++++++++++++++++++++++++++++++++ CHANGELOG.md | 17 ++++++++++ README.md | 17 +++++++++- docs/content/_index.md | 2 +- docs/content/ci-integration.md | 32 ++++++++++++++++--- docs/content/installation.md | 17 +++++++--- 7 files changed, 166 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a3c58e0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: ci + +on: + push: + branches: + - '**' + pull_request: + +permissions: + contents: read + +jobs: + ci: + name: vet, staticcheck, test, build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + - name: vet + run: go vet ./... + + - name: staticcheck + run: go tool staticcheck ./... + + - name: test + run: go test ./... + + - name: build + run: go build -o /dev/null ./cmd/... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b799137 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + name: Build and publish release + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + # Artifact names, platforms and flags must stay identical to + # .gitea/workflows/release.yml so both forges publish the same files. + - name: Build binaries + env: + TAG: ${{ github.ref_name }} + CGO_ENABLED: "0" + run: | + for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do + goos="${target%/*}" + goarch="${target#*/}" + ext="" + if [ "$goos" = "windows" ]; then ext=".exe"; fi + GOOS="$goos" GOARCH="$goarch" go build -trimpath \ + -ldflags="-s -w -X main.version=${TAG}" \ + -o "releaser-${TAG}-${goos}-${goarch}${ext}" \ + ./cmd/... + done + + - name: Create release and upload assets + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.ref_name }} + run: | + gh release create "$TAG" \ + --repo "$GITHUB_REPOSITORY" \ + --title "$TAG" \ + --notes "" \ + --verify-tag \ + "releaser-${TAG}-linux-amd64" \ + "releaser-${TAG}-linux-arm64" \ + "releaser-${TAG}-darwin-amd64" \ + "releaser-${TAG}-darwin-arm64" \ + "releaser-${TAG}-windows-amd64.exe" diff --git a/CHANGELOG.md b/CHANGELOG.md index 65e2dd0..363781f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,23 @@ All notable changes to this project will be documented in this file. Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [Unreleased] + +### Added + +- **GitHub mirror** — the repository is mirrored from git.k3nny.fr (still the primary source) to [github.com/k3nnyfr/releaser](https://github.com/k3nnyfr/releaser) +- **GitHub Actions workflows** — `.github/workflows/ci.yml` runs the same vet / staticcheck / test / build checks as the Gitea CI; `.github/workflows/release.yml` builds the same five binaries (same names, same `-trimpath -ldflags="-s -w -X main.version="` flags) on `v*` tags and publishes them with `gh release create`, so every new release is available on both forges + +### Changed + +- **Installation docs** — README gains an Installation section; `docs/content/installation.md` lists both release pages and shows the GitHub download URL +- **GitHub Actions example** — `docs/content/ci-integration.md` now downloads the binary from GitHub releases with an explicit version, picking the platform from `RUNNER_OS` / `RUNNER_ARCH` + +### Fixed + +- **Broken download URL in the GitHub Actions example** — `releases/latest/download/releaser-linux-amd64` never matched a real asset (asset names embed the tag) +- **Build-from-source instructions** — clone URL was `…/k3nny/releaser/releaser.git` (404); stated Go requirement was 1.21+ while `go.mod` requires 1.26 + ## [1.10.0] - 2026-07-16 ### Added diff --git a/README.md b/README.md index d59dcda..de4ae31 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A CI-friendly release automation tool for GitFlow workflows using Conventional Commits. -**[Documentation](https://releaser.k3nny.fr)** · **[Repository](https://git.k3nny.fr/k3nny/releaser)** +**[Documentation](https://releaser.k3nny.fr)** · **[Repository](https://git.k3nny.fr/k3nny/releaser)** · **[GitHub mirror](https://github.com/k3nnyfr/releaser)** ## Problem @@ -42,6 +42,21 @@ By default, all releasable commits bump the **patch** component (minor is pinned | `chore:`, `docs:`, etc. | none | — | | unparseable msg | none | non-strict mode: silently ignored | +## Installation + +Pre-built binaries (`linux-amd64`, `linux-arm64`, `darwin-amd64`, `darwin-arm64`, `windows-amd64.exe`) are published for every tag on both forges: + +- **[git.k3nny.fr releases](https://git.k3nny.fr/k3nny/releaser/releases)** — primary repository +- **[GitHub releases](https://github.com/k3nnyfr/releaser/releases)** — read-only mirror of git.k3nny.fr; issues and contributions go to the primary repository + +```bash +curl -sSL https://github.com/k3nnyfr/releaser/releases/download/v1.10.0/releaser-v1.10.0-linux-amd64 \ + -o /usr/local/bin/releaser +chmod +x /usr/local/bin/releaser +``` + +See the [installation docs](https://releaser.k3nny.fr/installation/) for Docker and building from source. + ## Usage ```bash diff --git a/docs/content/_index.md b/docs/content/_index.md index ce36044..c40f000 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -4,7 +4,7 @@ title: releaser **CI-friendly release automation for GitFlow workflows using Conventional Commits.** -[Source code](https://git.k3nny.fr/k3nny/releaser) · [Releases](https://git.k3nny.fr/k3nny/releaser/releases) +[Source code](https://git.k3nny.fr/k3nny/releaser) · [Releases](https://git.k3nny.fr/k3nny/releaser/releases) · [GitHub mirror](https://github.com/k3nnyfr/releaser) Standard tools like `semantic-release` are designed for trunk-based development. In a GitFlow setup with versioned release branches (`release/1.1`, `release/1.2`), they either fail to respect the branch's version range or require brittle configuration. diff --git a/docs/content/ci-integration.md b/docs/content/ci-integration.md index 5d10322..09cc80a 100644 --- a/docs/content/ci-integration.md +++ b/docs/content/ci-integration.md @@ -80,14 +80,36 @@ jobs: with: fetch-depth: 0 # full history needed for tag discovery + - name: Install releaser + shell: bash + env: + RELEASER_VERSION: v1.10.0 + # On Gitea Actions, https://git.k3nny.fr/k3nny/releaser/releases/download works too. + RELEASER_BASE_URL: https://github.com/k3nnyfr/releaser/releases/download + run: | + case "$RUNNER_OS" in + Linux) os=linux ;; + macOS) os=darwin ;; + Windows) os=windows ;; + *) echo "unsupported RUNNER_OS: $RUNNER_OS" >&2; exit 1 ;; + esac + case "$RUNNER_ARCH" in + X64) arch=amd64 ;; + ARM64) arch=arm64 ;; + *) echo "unsupported RUNNER_ARCH: $RUNNER_ARCH" >&2; exit 1 ;; + esac + ext="" + if [ "$os" = "windows" ]; then ext=".exe"; fi + mkdir -p "$RUNNER_TEMP/releaser" + curl -fsSL "$RELEASER_BASE_URL/$RELEASER_VERSION/releaser-$RELEASER_VERSION-$os-$arch$ext" \ + -o "$RUNNER_TEMP/releaser/releaser$ext" + chmod +x "$RUNNER_TEMP/releaser/releaser$ext" + echo "$RUNNER_TEMP/releaser" >> "$GITHUB_PATH" + - name: Run releaser env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - curl -sSL https://git.k3nny.fr/k3nny/releaser/releases/latest/download/releaser-linux-amd64 \ - -o /usr/local/bin/releaser - chmod +x /usr/local/bin/releaser - releaser + run: releaser ``` {{< hint warning >}} diff --git a/docs/content/installation.md b/docs/content/installation.md index afd395d..d1465d0 100644 --- a/docs/content/installation.md +++ b/docs/content/installation.md @@ -5,16 +5,23 @@ weight: 10 ## Pre-built binaries -Download the latest release for your platform from the [Releases page](https://git.k3nny.fr/k3nny/releaser/releases). +Download the latest release for your platform from either forge — both publish identical binaries for every tag: + +- [git.k3nny.fr releases](https://git.k3nny.fr/k3nny/releaser/releases) (primary) +- [GitHub releases](https://github.com/k3nnyfr/releaser/releases) (mirror) ```bash # Linux (amd64) -curl -sSL https://git.k3nny.fr/k3nny/releaser/releases/download/v1.5.0/releaser-v1.5.0-linux-amd64 \ +curl -sSL https://git.k3nny.fr/k3nny/releaser/releases/download/v1.10.0/releaser-v1.10.0-linux-amd64 \ -o /usr/local/bin/releaser chmod +x /usr/local/bin/releaser + +# Same binary from the GitHub mirror +curl -sSL https://github.com/k3nnyfr/releaser/releases/download/v1.10.0/releaser-v1.10.0-linux-amd64 \ + -o /usr/local/bin/releaser ``` -Available platforms: `linux-amd64`, `linux-arm64`, `darwin-amd64`, `darwin-arm64`, `windows-amd64.exe`. +Available platforms: `linux-amd64`, `linux-arm64`, `darwin-amd64`, `darwin-arm64`, `windows-amd64.exe`. Asset names embed the tag (`releaser---`), so download URLs must name an explicit version. ## Docker @@ -30,10 +37,10 @@ docker run --rm \ ## Build from source -Requires Go 1.21+. +Requires the Go version declared in `go.mod` (1.26+). ```bash -git clone https://git.k3nny.fr/k3nny/releaser/releaser.git +git clone https://git.k3nny.fr/k3nny/releaser.git # or https://github.com/k3nnyfr/releaser.git cd releaser go build -o /usr/local/bin/releaser ./cmd ```