mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -05:00
ci(release): add one-button release cut from main (#20)
Releases were tag-driven: a maintainer hand-bumped pom.xml, hand-moved the
CHANGELOG [Unreleased] entries under a new heading, committed, then pushed a
SemVer tag. Three manual steps, each able to disagree with the others.
Add a manually-dispatched Release Cut workflow that runs semantic-release
against main: it analyzes the Conventional Commits since the last tag, bumps
pom.xml via `mvn versions:set`, regenerates CHANGELOG.md, commits both, tags
(tagFormat ${version}), and creates the GitHub Release. The tag push then
fires release.yml exactly as a manual tag push did, so the binary build and
homebrew-bump chain is untouched. A dry-run input previews the next version
and notes without releasing.
The cut needs a fine-grained PAT (GH_TOKEN, contents:write) rather than the
default GITHUB_TOKEN, whose tag pushes do not trigger other workflows — with
it, release.yml would never run. The semantic-release toolchain is pinned by
its own package-lock.json and installed with `npm ci --ignore-scripts`, so
the job holding that PAT never resolves mutable versions.
CHANGELOG.md becomes generated output. The hand-maintained [Unreleased]
section and its compare link are removed, the header explains the new
contract, and historic sections stay as they were. Changelog Guard fails any
PR that edits the file by hand unless a maintainer applies the
`changelog-edit` label.
Since commit messages are now the changelog, add a Conventional Commits
workflow that lints every non-merge commit in a PR against the types
semantic-release recognizes.
Also drop the hand-written installation body from release.yml — the release
now carries just the attachments, and semantic-release writes the notes.
This commit is contained in:
1 parent
6496795708
commit
7cef52bc50
9 files changed
+6278
-45
No files matched your search
+6067
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "release-tooling",
|
||||
"private": true,
|
||||
"description": "Pinned semantic-release toolchain for the Release Cut workflow (npm ci only; not part of the CLI build)",
|
||||
"devDependencies": {
|
||||
"semantic-release": "24.2.9",
|
||||
"@semantic-release/changelog": "7.0.0",
|
||||
"@semantic-release/exec": "7.1.0",
|
||||
"@semantic-release/git": "11.0.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
name: Changelog Guard
|
||||
|
||||
# CHANGELOG.md is generated by semantic-release (the Release Cut workflow) —
|
||||
# a contributor's Conventional Commit message IS the changelog entry, so PRs
|
||||
# must not edit the file by hand. Genuine corrections (typos in history,
|
||||
# security notes) are allowed by adding the `changelog-edit` label to the PR.
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, labeled, unlabeled]
|
||||
paths:
|
||||
- 'CHANGELOG.md'
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
guard:
|
||||
name: CHANGELOG.md is generated
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changelog-edit') }}
|
||||
steps:
|
||||
- name: Reject hand edits
|
||||
run: |
|
||||
echo "::error::CHANGELOG.md is generated by semantic-release — your Conventional Commit message is the changelog entry. Remove the CHANGELOG.md changes from this PR, or ask a maintainer for the 'changelog-edit' label if this is a genuine correction."
|
||||
exit 1
|
||||
@@ -0,0 +1,63 @@
|
||||
name: Conventional Commits
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, synchronize, reopened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
lint-commits:
|
||||
name: Commits follow Conventional Commits
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Validate commit messages
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
# Conventional Commits pattern:
|
||||
# <type>[optional scope]: <description>
|
||||
#
|
||||
# Types recognised by semantic-release (commit-analyzer defaults):
|
||||
# feat, fix, perf, revert, docs, style, chore, refactor, test, build, ci
|
||||
#
|
||||
# Breaking changes are signalled by appending ! before the colon:
|
||||
# feat!: or feat(scope)!:
|
||||
#
|
||||
# Merge commits are skipped automatically via --no-merges.
|
||||
#
|
||||
# References:
|
||||
# https://www.conventionalcommits.org/en/v1.0.0/
|
||||
|
||||
PATTERN='^(feat|fix|perf|revert|docs|style|chore|refactor|test|build|ci)(\([-a-zA-Z0-9_.,]+\))?!?: .{1,}'
|
||||
FAILED=0
|
||||
|
||||
while IFS= read -r msg; do
|
||||
if echo "$msg" | grep -qE "$PATTERN"; then
|
||||
echo "ok: $msg"
|
||||
else
|
||||
echo "::error::Commit does not follow Conventional Commits: $msg"
|
||||
echo ""
|
||||
echo " Got: $msg"
|
||||
echo ""
|
||||
echo " Expected format: <type>[optional scope]: <description>"
|
||||
echo " Examples:"
|
||||
echo " feat(pubsub): add subscription filter support"
|
||||
echo " fix(gcs): correct ETag format for multipart uploads"
|
||||
echo " chore: release 1.0.0"
|
||||
echo " feat!: remove legacy endpoint"
|
||||
echo ""
|
||||
echo " Valid types: feat, fix, perf, revert, docs, style, chore, refactor, test, build, ci"
|
||||
echo " See: https://www.conventionalcommits.org/en/v1.0.0/"
|
||||
FAILED=1
|
||||
fi
|
||||
done < <(git log --no-merges --format="%s" "$BASE_SHA".."$HEAD_SHA")
|
||||
|
||||
exit $FAILED
|
||||
@@ -0,0 +1,73 @@
|
||||
name: Release Cut
|
||||
|
||||
# One-button release from main.
|
||||
#
|
||||
# Manually dispatched: semantic-release analyzes the Conventional Commits on
|
||||
# main, bumps pom.xml (via the exec plugin running `mvn versions:set`), writes
|
||||
# CHANGELOG.md, commits those files, tags the release (tagFormat: ${version}),
|
||||
# and creates the GitHub Release. The tag push then fires release.yml exactly
|
||||
# as a manual tag push does today.
|
||||
#
|
||||
# GH_TOKEN must be a fine-grained PAT with contents:write. The default
|
||||
# GITHUB_TOKEN cannot be used: tags pushed with it do not trigger other
|
||||
# workflows (GitHub's recursion guard), so release.yml would never run.
|
||||
#
|
||||
# Maven note: the exec plugin invokes `mvn versions:set`; ubuntu-latest ships
|
||||
# a system mvn, which is sufficient for that goal.
|
||||
#
|
||||
# The toolchain is pinned: .github/release-tooling/package-lock.json is the
|
||||
# only source of the semantic-release dependency tree (npm ci --ignore-scripts),
|
||||
# so the job that holds the write PAT never resolves mutable versions.
|
||||
#
|
||||
# Required secrets: GH_TOKEN
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dry-run:
|
||||
description: 'Dry run (compute the next version and release notes without releasing)'
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
# Serialize release cuts: a second dispatch queues behind the first instead of
|
||||
# racing it to the same version/tag. No cancel-in-progress — never kill a
|
||||
# mid-flight release. GitHub keeps at most ONE pending run per group, so if
|
||||
# several dispatches pile up, only the latest pending one runs — intentional:
|
||||
# duplicate queued release cuts are redundant by definition (the surviving run
|
||||
# re-analyzes main and releases whatever is unreleased).
|
||||
concurrency:
|
||||
group: release-cut
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Cut release from main
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: main
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0
|
||||
with:
|
||||
java-version: '25'
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install the pinned release toolchain
|
||||
run: npm ci --prefix .github/release-tooling --ignore-scripts
|
||||
|
||||
- name: Run semantic-release
|
||||
run: ./.github/release-tooling/node_modules/.bin/semantic-release ${{ inputs.dry-run && '--dry-run' || '' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
@@ -174,27 +174,6 @@ jobs:
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
name: "floci ${{ steps.version.outputs.version }}"
|
||||
body: |
|
||||
## Installation
|
||||
|
||||
**Homebrew:**
|
||||
```sh
|
||||
brew install floci-io/floci/floci
|
||||
```
|
||||
|
||||
**Direct download (Linux/macOS):**
|
||||
```sh
|
||||
curl -fsSL https://floci.io/install.sh | sh
|
||||
```
|
||||
|
||||
**Windows:**
|
||||
```powershell
|
||||
iwr https://floci.io/install.ps1 | iex
|
||||
```
|
||||
|
||||
**JVM fallback** (requires Java 25+): `floci.jar`
|
||||
|
||||
See [CHANGELOG.md](CHANGELOG.md) for what's new.
|
||||
files: |
|
||||
dist/floci-linux-amd64/floci-linux-amd64
|
||||
dist/floci-linux-arm64/floci-linux-arm64
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"tagFormat": "${version}",
|
||||
"branches": [
|
||||
"main"
|
||||
],
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
[
|
||||
"@semantic-release/changelog",
|
||||
{
|
||||
"changelogFile": "CHANGELOG.md",
|
||||
"changelogTitle": "# Changelog\n\nEntries in this file are generated by [semantic-release](https://github.com/semantic-release/semantic-release) from Conventional Commit messages — do not edit it by hand; your commit message is the changelog entry. Historic sections at the bottom were maintained by hand in the Keep a Changelog format."
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/exec",
|
||||
{
|
||||
"prepareCmd": "mvn versions:set -DnewVersion=${nextRelease.version} -DgenerateBackupPoms=false"
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": [
|
||||
"pom.xml",
|
||||
"CHANGELOG.md"
|
||||
],
|
||||
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
|
||||
}
|
||||
],
|
||||
"@semantic-release/github"
|
||||
]
|
||||
}
|
||||
+1
-11
@@ -1,15 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to `floci-cli` will be documented in this file.
|
||||
|
||||
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
This project uses [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- `floci az env` printed the semicolon-separated Azure connection string unquoted, so `eval $(floci az env)` set only `AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=http` and ran the remaining segments as commands — `az` then reported `Invalid connection string`. All four trees now share one emitter (`ShellExport`) that single-quotes values with per-shell escaping for bash, fish, and PowerShell (the form `floci oci env` already used), so `;`, `$`, backticks, and quotes in a value can no longer break or inject through `eval`. `floci env` and `floci gcp env` carried the same unquoted emitter, and the `aws.cli.endpoint` / `az.cli.connection-string` doctor hints suggested export lines with the same flaw; both are fixed ([#18](https://github.com/floci-io/floci-cli/issues/18))
|
||||
Entries in this file are generated by [semantic-release](https://github.com/semantic-release/semantic-release) from Conventional Commit messages — do not edit it by hand; your commit message is the changelog entry. Historic sections at the bottom were maintained by hand in the Keep a Changelog format.
|
||||
|
||||
## [0.2.0] — 2026-07-28
|
||||
|
||||
@@ -155,7 +146,6 @@ This project uses [Semantic Versioning](https://semver.org/).
|
||||
- `floci logs --service` filter is not yet supported (requires server-side log routing)
|
||||
- Shell completion for `fish` and `powershell` is not yet generated by Picocli
|
||||
|
||||
[Unreleased]: https://github.com/floci-io/floci-cli/compare/0.1.9...HEAD
|
||||
[0.1.9]: https://github.com/floci-io/floci-cli/compare/0.1.8...0.1.9
|
||||
[0.1.8]: https://github.com/floci-io/floci-cli/compare/0.1.7...0.1.8
|
||||
[0.1.7]: https://github.com/floci-io/floci-cli/compare/0.1.6...0.1.7
|
||||
|
||||
+4
-13
@@ -115,7 +115,7 @@ Do not include `Co-Authored-By` trailers for AI tools in commit messages. Attrib
|
||||
|
||||
## Changelog
|
||||
|
||||
`CHANGELOG.md` follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and is maintained **by hand** (no semantic-release). Every PR with a user-visible change must add an entry under `[Unreleased]` in the same PR, written from the user's point of view (what was broken / what's new, not how it was implemented).
|
||||
`CHANGELOG.md` is generated by [semantic-release](https://github.com/semantic-release/semantic-release) from Conventional Commit messages — **do not edit it by hand**. Your commit message *is* the changelog entry, so write it from the user's point of view (what was broken / what's new, not how it was implemented). Genuine corrections to the file (typos in history, security notes) require the `changelog-edit` label on the PR.
|
||||
|
||||
## Pull Request Guidelines
|
||||
|
||||
@@ -135,20 +135,11 @@ Do not include `Co-Authored-By` trailers for AI tools in commit messages. Attrib
|
||||
|
||||
## Release Process (maintainers)
|
||||
|
||||
Releases are **tag-driven**. Binaries are never published on PR merge — only when a SemVer tag is pushed.
|
||||
Releases are cut from `main` with the **Release Cut** workflow (Actions → Release Cut → Run workflow). semantic-release analyzes the Conventional Commits since the last tag, bumps `<version>` in `pom.xml`, regenerates `CHANGELOG.md`, commits, tags, and publishes the GitHub Release. Use the `dry-run` input to preview the next version and release notes without releasing anything.
|
||||
|
||||
```bash
|
||||
# 1. On main: bump <version> in pom.xml, move [Unreleased] entries in
|
||||
# CHANGELOG.md under the new version heading, and commit
|
||||
git commit -am "chore: release 0.2.0"
|
||||
git push
|
||||
The tag push then triggers `release.yml` exactly as a manual tag push did before: native binaries for linux/amd64, linux/arm64, darwin/amd64, darwin/arm64 and windows/amd64, plus the fat JAR, published as a GitHub Release with `sha256sums.txt`. A successful release triggers `homebrew-bump.yml`, which opens a version-bump PR against the Homebrew tap automatically.
|
||||
|
||||
# 2. Tag and push — this triggers the release pipeline
|
||||
git tag 0.2.0
|
||||
git push origin 0.2.0
|
||||
```
|
||||
|
||||
The tag push triggers `release.yml`, which builds native binaries for linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, and windows/amd64, plus the fat JAR, and publishes a GitHub Release with `sha256sums.txt`. A successful release then triggers `homebrew-bump.yml`, which opens a version-bump PR against the Homebrew tap automatically.
|
||||
Nothing is published on PR merge — only a release cut produces artifacts.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
|
||||
Reference in new issue
Block a user