Files
floci/.github/workflows/release.yml
T
Hector Ventura 61011c0fa8 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.
2026-08-05 22:53:20 -05:00

202 lines
7.1 KiB
YAML

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
# 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, AWS_ROLE_ARN
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
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
# in parallel rather than cancelling each other. Re-runs of the same tag
# supersede in-flight builds of that tag.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# ── Build native artifact — amd64 ────────────────────────────────────────
build-native-amd64:
name: Build native artifact (amd64)
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7.0.1
- uses: graalvm/setup-graalvm@0def53c0fd8534bc13416c9469f5be45265824fd # v1
with:
java-version: '25'
distribution: 'mandrel'
cache: maven
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build native executable
run: mvn clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-march=x86-64-v2"
- uses: actions/upload-artifact@v7
with:
name: native-amd64
path: |
target/*-runner
target/*.properties
target/*.so
if-no-files-found: warn
retention-days: 1
# ── Build native artifact — arm64 ────────────────────────────────────────
build-native-arm64:
name: Build native artifact (arm64)
runs-on: ubuntu-24.04-arm
timeout-minutes: 45
steps:
- uses: actions/checkout@v7.0.1
- uses: graalvm/setup-graalvm@0def53c0fd8534bc13416c9469f5be45265824fd # v1
with:
java-version: '25'
distribution: 'mandrel'
cache: maven
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build native executable
run: mvn clean package -Dnative -DskipTests -B
- uses: actions/upload-artifact@v7
with:
name: native-arm64
path: |
target/*-runner
target/*.properties
target/*.so
if-no-files-found: warn
retention-days: 1
# ── Push native + compat Docker images ───────────────────────────────────
push-native:
name: Push native and compat Docker images
needs: [build-native-amd64, build-native-arm64]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7.0.1
- name: Extract version
id: version
run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- name: Set created timestamp
id: created
run: echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
- name: Set SOURCE_DATE_EPOCH
id: source_date
run: echo "epoch=$(git log -1 --pretty=%ct)" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v8
with:
name: native-amd64
path: native/amd64/
- uses: actions/download-artifact@v8
with:
name: native-arm64
path: native/arm64/
- name: Stage binaries under a fixed name
run: |
for arch in amd64 arm64; do
mv native/$arch/*-runner native/$arch/application
done
- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4.5.1
with:
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:
SOURCE_DATE_EPOCH: ${{ steps.source_date.outputs.epoch }}
with:
context: .
file: docker/Dockerfile.native-package
platforms: linux/amd64,linux/arm64
push: true
provenance: mode=max
sbom: true
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: |
org.opencontainers.image.version=${{ steps.version.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ steps.created.outputs.created }}
version=${{ steps.version.outputs.version }}
build-date=${{ steps.created.outputs.created }}
vcs-ref=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push compat multi-arch image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
env:
SOURCE_DATE_EPOCH: ${{ steps.source_date.outputs.epoch }}
with:
context: .
file: docker/Dockerfile.compat
platforms: linux/amd64,linux/arm64
push: true
provenance: mode=max
sbom: true
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: |
org.opencontainers.image.version=${{ steps.version.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ steps.created.outputs.created }}
version=${{ steps.version.outputs.version }}
build-date=${{ steps.created.outputs.created }}
vcs-ref=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max