mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
feat(release): one-button release cut from main and ECR Public versioned publishing (#2127)
* feat(release): one-button release cut from main and ECR Public versioned publishing - New Release Cut workflow (workflow_dispatch, dry-run input): semantic-release bumps pom.xml, writes CHANGELOG.md, commits, tags, and creates the GitHub Release; the tag push fires release.yml unchanged. Requires a GH_TOKEN fine-grained PAT (contents:write) because tags pushed with the default GITHUB_TOKEN do not trigger workflows. - .releaserc.json: release from main only (release/x.y.x retired for now) - release.yml: push versioned + latest native and compat tags to ECR Public, mirroring nightly.yml (OIDC role, public.ecr.aws/floci/floci) — previously only nightlies reached ECR Public * fix(release): serialize release cuts and pin the release toolchain Address review findings on the Release Cut workflow: - concurrency group so overlapping dispatches queue instead of racing to push the same version/tag (no cancel-in-progress: a mid-flight release is never killed) - the semantic-release toolchain is now installed with npm ci --ignore-scripts from a committed manifest + lockfile (.github/release-tooling), so the job holding the contents:write PAT runs a reproducible, fully pinned dependency tree instead of resolving mutable version ranges at run time * fix(release): commit the pinned lockfile, SHA-pin actions, document queue semantics Replicates the review fixes that took the sibling OCI PR to a clean review: - the repo-wide package-lock.json ignore silently excluded the release toolchain's lockfile, so npm ci would fail on every dispatch; add a scoped gitignore exception and commit the lockfile - pin checkout/setup-java/setup-node to full commit SHAs — this workflow holds the contents:write GH_TOKEN PAT, so a repointed action tag must not be able to change the code it executes - document the concurrency group's last-dispatch-wins semantics (GitHub keeps one pending run per group; a superseded duplicate release cut is redundant by definition) * fix(release): pin the ECR publishing actions to full commit SHAs The OIDC-enabled job that assumes the public-image publishing role must not execute code selected by a repointable tag: configure-aws-credentials and amazon-ecr-login are now pinned to full commit SHAs (tags noted in comments), matching the SHA-pinned docker actions already in this workflow.
This commit is contained in:
1 parent
7f51c746cd
commit
61011c0fa8
8 files changed
+6184
-10
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 emulator 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,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 }}
|
||||
@@ -1,13 +1,16 @@
|
||||
name: Release
|
||||
|
||||
# Triggered when a version tag (e.g. 1.2.3) is pushed.
|
||||
# Builds native (amd64 + arm64) Docker images and pushes them to Docker Hub.
|
||||
# Builds native (amd64 + arm64) Docker images and pushes them to Docker Hub
|
||||
# and Amazon ECR Public.
|
||||
#
|
||||
# Published tags:
|
||||
# Native: floci/floci:1.2.3 floci/floci:latest
|
||||
# public.ecr.aws/floci/floci:1.2.3 public.ecr.aws/floci/floci:latest
|
||||
# Compat: floci/floci:1.2.3-compat floci/floci:latest-compat
|
||||
# public.ecr.aws/floci/floci:1.2.3-compat public.ecr.aws/floci/floci:latest-compat
|
||||
#
|
||||
# Required secrets: DOCKERHUB_USERNAME, DOCKERHUB_TOKEN
|
||||
# Required secrets: DOCKERHUB_USERNAME, DOCKERHUB_TOKEN, AWS_ROLE_ARN
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -16,6 +19,7 @@ on:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
|
||||
# Per-tag concurrency. Back-to-back tag pushes (e.g. 1.5.3 and 1.6.0 landing
|
||||
# minutes apart) resolve to different ${{ github.ref }} values, so they run
|
||||
@@ -129,6 +133,17 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@e6de054238d6b7531b4efff3b6587d9aade6a06c # v6.2.3
|
||||
with:
|
||||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- name: Login to Amazon ECR Public
|
||||
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
|
||||
with:
|
||||
registry-type: public
|
||||
|
||||
- name: Build and push native multi-arch image
|
||||
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
||||
env:
|
||||
@@ -143,6 +158,8 @@ jobs:
|
||||
tags: |
|
||||
floci/floci:${{ steps.version.outputs.version }}
|
||||
floci/floci:latest
|
||||
public.ecr.aws/floci/floci:${{ steps.version.outputs.version }}
|
||||
public.ecr.aws/floci/floci:latest
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
labels: |
|
||||
@@ -169,6 +186,8 @@ jobs:
|
||||
tags: |
|
||||
floci/floci:${{ steps.version.outputs.version }}-compat
|
||||
floci/floci:latest-compat
|
||||
public.ecr.aws/floci/floci:${{ steps.version.outputs.version }}-compat
|
||||
public.ecr.aws/floci/floci:latest-compat
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
labels: |
|
||||
|
||||
@@ -36,3 +36,7 @@ scripts/node_modules/
|
||||
# Python tooling caches
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# The Release Cut toolchain is pinned; its lockfile must be committed
|
||||
# (npm ci fails without it) despite the global package-lock.json ignore.
|
||||
!.github/release-tooling/package-lock.json
|
||||
+1
-6
@@ -1,11 +1,6 @@
|
||||
{
|
||||
"tagFormat": "${version}",
|
||||
"branches": [
|
||||
{
|
||||
"name": "release/+([0-9])?(.{+([0-9]),x}).x",
|
||||
"channel": "${name.replace(/^release\\//,'')}"
|
||||
}
|
||||
],
|
||||
"branches": ["main"],
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
|
||||
@@ -306,8 +306,11 @@ Do not add `Co-Authored-By` trailers for AI tools in commit messages. Keep attri
|
||||
## Release Awareness
|
||||
|
||||
- Changes merged into `main` do not automatically imply a stable release
|
||||
- Release branches define stable release lines
|
||||
- Tags trigger publishing workflows
|
||||
- Releases are cut from `main` via the "Release Cut" workflow (`workflow_dispatch`
|
||||
on `.github/workflows/release-cut.yml`), which runs semantic-release: it bumps
|
||||
`pom.xml`, writes `CHANGELOG.md`, commits, tags, and creates the GitHub Release
|
||||
- `release/x.y.x` branches are retired for now
|
||||
- Tags still trigger the publishing workflows (`release.yml`)
|
||||
|
||||
Treat release workflows as critical infrastructure.
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- **release:** one-button releases — new "Release Cut" workflow (`workflow_dispatch`, with a dry-run option) runs semantic-release from `main`: bumps `pom.xml`, writes `CHANGELOG.md`, commits, tags, and creates the GitHub Release; the tag then triggers the existing publishing workflow. `release/x.y.x` branches are retired for now
|
||||
- **release:** versioned images are now also published to Amazon ECR Public (`public.ecr.aws/floci/floci:x.y.z`, `latest`, `x.y.z-compat`, `latest-compat`), mirroring the nightly ECR Public publishing
|
||||
- **apigateway:** support the reserved `floci:override-id` tag on `CreateRestApi` (v1) and `CreateApi` (v2) to pin the generated API ID, unifying custom IDs with the tag KMS and Cognito already use. Override keys are stripped from the returned tags, validated (non-blank, no whitespace/control characters and no `/`, `?`, `#`) and rejected on `TagResource` with `BadRequestException`, which is what both services declare. The older API-Gateway-specific `_custom_id_` tag still works as a deprecated fallback and is now stripped too; `floci:override-id` wins when both are present. Creating an API whose override ID already exists in the region is rejected with `ConflictException` (409) instead of overwriting the existing API ([#1593](https://github.com/floci-io/floci/pull/1593))
|
||||
|
||||
### Changed
|
||||
|
||||
Reference in new issue
Block a user