diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index 1d58e0ee22..8f6c359ef3 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -13,6 +13,11 @@ permissions: {} required: true type: string description: 'JSON array of apps to build (e.g., [{"name": "testapp", "dockerfile": "apps/testapp/Dockerfile"}])' + latest: + required: false + type: boolean + default: false + description: 'Also tag images as :latest' jobs: build-images: @@ -47,6 +52,8 @@ jobs: file: ${{ matrix.app.dockerfile }} push: true platforms: linux/amd64,linux/arm64 - tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.app.name }}:${{ inputs.image-tag }} + tags: | + ghcr.io/${{ github.repository_owner }}/${{ matrix.app.name }}:${{ inputs.image-tag }} + ${{ inputs.latest && format('ghcr.io/{0}/{1}:latest', github.repository_owner, matrix.app.name) || '' }} cache-from: type=gha,scope=${{ matrix.app.name }} cache-to: type=gha,mode=max,scope=${{ matrix.app.name }} diff --git a/.github/workflows/release-apps.yml b/.github/workflows/release-apps.yml deleted file mode 100644 index 53b3aeca17..0000000000 --- a/.github/workflows/release-apps.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: Apps release -on: - push: - tags: - - "apps/**/v*.*.*" # Match app module tags, excluding root and library module tags. - workflow_dispatch: - inputs: - tag: - description: "Tag to release (e.g., apps/evm/single/v0.2.0, apps/testapp/v0.4.0) - Must match Go tag." - required: true - type: string - -permissions: {} -jobs: - parse-tag: - name: Parse Release Tag - runs-on: ubuntu-latest - permissions: - contents: read - outputs: - app-path: ${{ steps.parse.outputs.app-path }} - version: ${{ steps.parse.outputs.version }} - image-name: ${{ steps.parse.outputs.image-name }} - dockerfile: ${{ steps.parse.outputs.dockerfile }} - steps: - - name: Checkout code - uses: actions/checkout@v7.0.1 - - - name: Parse tag and validate app - id: parse - run: | - # Use input tag for workflow_dispatch, otherwise use ref_name - if [ -n "${{ inputs.tag }}" ]; then - TAG="${{ inputs.tag }}" - else - TAG="${{ github.ref_name }}" - fi - echo "Processing tag: $TAG" - - # Extract version (everything after the last /) - VERSION="${TAG##*/}" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - # Extract app path (everything before the last /) - APP_PATH="${TAG%/*}" - echo "app-path=$APP_PATH" >> $GITHUB_OUTPUT - - # Check if the app directory exists - if [ ! -d "$APP_PATH" ]; then - echo "::error::App directory '$APP_PATH' does not exist" - exit 1 - fi - - # Check if Dockerfile exists - if [ ! -f "$APP_PATH/Dockerfile" ]; then - echo "::error::Dockerfile not found in '$APP_PATH/'" - exit 1 - fi - - echo "dockerfile=$APP_PATH/Dockerfile" >> $GITHUB_OUTPUT - - # Generate image name from app path (strip apps/ prefix, replace / with -) - IMAGE_PATH="${APP_PATH#apps/}" - IMAGE_NAME="ev-node-${IMAGE_PATH//\//-}" - echo "image-name=$IMAGE_NAME" >> $GITHUB_OUTPUT - - echo "::notice::Building $IMAGE_NAME version $VERSION from $APP_PATH" - - build-and-push: - name: Build and Push Docker Image - needs: parse-tag - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout code - uses: actions/checkout@v7.0.1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 - - - name: Log in to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Docker image - uses: docker/build-push-action@v7 - with: - context: . - file: ${{ needs.parse-tag.outputs.dockerfile }} - push: true - platforms: linux/amd64,linux/arm64 - tags: | - ghcr.io/${{ github.repository_owner }}/${{ needs.parse-tag.outputs.image-name }}:${{ needs.parse-tag.outputs.version }} - ghcr.io/${{ github.repository_owner }}/${{ needs.parse-tag.outputs.image-name }}:latest diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml deleted file mode 100644 index b3a18208df..0000000000 --- a/.github/workflows/release-github.yml +++ /dev/null @@ -1,191 +0,0 @@ -name: Github Release -on: - workflow_dispatch: - inputs: - tag: - description: "Release tag (e.g., v1.2.3)" - required: true - type: string - -permissions: - contents: write - id-token: write - -jobs: - create-draft-release: - name: Create Draft Release - runs-on: ubuntu-latest - steps: - - name: Validate semver tag - run: | - TAG="${{ github.event.inputs.tag }}" - - # Check if tag matches semver pattern (v followed by MAJOR.MINOR.PATCH with optional pre-release and build metadata) - # Supports: v1.2.3, v1.2.3-rc.4, v1.2.3-beta.1, v1.2.3-alpha.1+build.123 - if ! echo "$TAG" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$'; then - echo "::error::Invalid tag format: $TAG" - echo "::error::Tag must be in semver format: v..[-PRERELEASE][+BUILD]" - echo "::error::Examples: v1.2.3, v1.2.3-rc.4, v1.2.3-beta.1, v1.2.3-alpha.1+build.123" - exit 1 - fi - - echo "::notice::Tag validation passed: $TAG" - - - name: Checkout code - uses: actions/checkout@v7.0.1 - with: - fetch-depth: 0 - - - name: Extract version from tag - id: extract-version - run: | - TAG="${{ github.event.inputs.tag }}" - VERSION="${TAG#v}" - echo "tag=$TAG" >> $GITHUB_OUTPUT - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "::notice::Tag: $TAG" - echo "::notice::Version: $VERSION" - - - name: Find previous tag - id: prev-tag - run: | - TAG="${{ steps.extract-version.outputs.tag }}" - PREV_TAG=$(git tag -l "v*.*.*" --sort=-version:refname | grep -v "^${TAG}$" | head -n1) - - if [ -z "$PREV_TAG" ]; then - echo "::notice::No previous tag found, using initial commit" - PREV_TAG=$(git rev-list --max-parents=0 HEAD) - fi - - echo "prev-tag=$PREV_TAG" >> $GITHUB_OUTPUT - echo "::notice::Previous tag: $PREV_TAG" - - - name: Get list of Docker images - id: get-images - run: | - # Find all apps with Dockerfiles - IMAGES="" - for app_dir in apps/*/; do - if [ -f "${app_dir}Dockerfile" ]; then - APP_NAME=$(basename "$app_dir") - IMAGE_NAME="ev-node-${APP_NAME}" - IMAGES="${IMAGES}ghcr.io/${{ github.repository_owner }}/${IMAGE_NAME}:${{ steps.extract-version.outputs.tag }}\n" - fi - done - - # Remove trailing newline - IMAGES=$(echo -e "$IMAGES" | sed '/^$/d') - - # Escape for GitHub Actions output - IMAGES="${IMAGES//'%'/'%25'}" - IMAGES="${IMAGES//$'\n'/'%0A'}" - IMAGES="${IMAGES//$'\r'/'%0D'}" - - echo "images=$IMAGES" >> $GITHUB_OUTPUT - echo "::notice::Found Docker images" - - - name: Generate changelog prompt - id: changelog-prompt - run: | - PREV_TAG="${{ steps.prev-tag.outputs.prev-tag }}" - TAG="${{ steps.extract-version.outputs.tag }}" - VERSION="${{ steps.extract-version.outputs.version }}" - - cat > claude-prompt.txt << 'EOF_PROMPT' - Read the file CHANGELOG.md and find the section for version $VERSION (tag $TAG). - - Generate professional release notes for GitHub based on the changes listed for this specific version. - - Create release notes with the following structure: - - ev-node VERSION - - ⚠️ This is a draft release. Please verify its content before publishing - - [Brief summary paragraph about this release - what type of release it is (feature/bugfix/maintenance), upgrade recommendations] - - **Tested upgrade paths** - - [List version upgrade paths that were tested, or state "TBD - to be tested before publishing"] - - ## ⚠️ Breaking Changes - - [If there are breaking changes, list each one with clear operational steps. If no breaking changes, state "None"] - - ### [Breaking Change Title] - **What changed:** [Clear description of what was changed/added/removed] - - **Action required:** - 1. [Step-by-step instructions on what operators need to do] - 2. [Include configuration changes, file modifications, etc.] - 3. [Provide examples where helpful] - - **Reference:** [PR number if available] - - --- - - ## Full Changelog - - For a complete list of all changes including new features, improvements, and bug fixes, see [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/$TAG/CHANGELOG.md#$VERSION). - - **Images** - EOF_PROMPT - - # Replace placeholders with actual values - sed -i "s/\$VERSION/${VERSION}/g" claude-prompt.txt - sed -i "s/\$TAG/${TAG}/g" claude-prompt.txt - - # Add the images list - echo "${{ steps.get-images.outputs.images }}" | while IFS= read -r image; do - echo "- $image" >> claude-prompt.txt - done - - cat >> claude-prompt.txt << 'EOF_PROMPT' - - Guidelines: - - Replace VERSION with the actual version number - - Replace YYYY-MM-DD with the actual release date - - ONLY include BREAKING changes in the "Breaking Changes" section - - For each breaking change, provide clear operational steps that operators must follow - - Include specific configuration file changes, command modifications, or migration steps - - Use numbered lists for action steps to make them easy to follow - - Do NOT duplicate the full changelog content - just reference CHANGELOG.md - - If there are no breaking changes, clearly state "None" in that section - - Use clear, professional language focused on operational impact - - Include PR numbers for breaking changes when available - - Format as clean markdown - - Output the release notes as your response. - EOF_PROMPT - - { - echo 'prompt<> $GITHUB_OUTPUT - - - name: Generate release notes with Claude - id: claude-release - uses: anthropics/claude-code-action@v1 - with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - prompt: ${{ steps.changelog-prompt.outputs.prompt }} - trusted_bots: "*" - allowed_tools: "Read(CHANGELOG.md)" - claude_args: | - --json-schema '{"type":"object","properties":{"release_notes":{"type":"string"},"release_date":{"type":"string","description":"Release date in YYYY-MM-DD format"}},"required":["release_notes","release_date"]}' - - - name: Create Draft GitHub Release - id: create-release - uses: softprops/action-gh-release@v3 - with: - draft: true - name: ${{ steps.extract-version.outputs.tag }} (${{ fromJSON(steps.claude-release.outputs.structured_output).release_date }}) - tag_name: ${{ steps.extract-version.outputs.tag }} - body: ${{ fromJSON(steps.claude-release.outputs.structured_output).release_notes }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Output release URL - run: | - RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/${{ steps.extract-version.outputs.tag }}" - echo "::notice::Draft release created: $RELEASE_URL" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..9436f9ec20 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,121 @@ +--- +name: Release +permissions: {} +"on": + push: + tags: + - "v*.*.*" + +concurrency: release-${{ github.ref }} + +jobs: + prepare: + name: Prepare + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + tag: ${{ steps.meta.outputs.tag }} + prerelease: ${{ steps.meta.outputs.prerelease }} + latest: ${{ steps.meta.outputs.latest }} + prev: ${{ steps.meta.outputs.prev }} + apps: ${{ steps.meta.outputs.apps }} + steps: + - uses: actions/checkout@v7.0.1 + with: + fetch-depth: 0 + + - name: Compute release metadata + id: meta + env: + TAG: ${{ github.ref_name }} + run: | + if ! echo "$TAG" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$'; then + echo "::error::Invalid tag format: $TAG" + echo "::error::Tag must be in semver format: v..[-PRERELEASE] (no +BUILD)" + exit 1 + fi + + prerelease=false + [[ "$TAG" == *-* ]] && prerelease=true + + highest=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n1) + latest=false + [ "$TAG" = "$highest" ] && latest=true + + exclude=() + [ "$prerelease" = false ] && exclude=(--exclude='v*-*') + prev=$(git describe --tags --abbrev=0 --match 'v[0-9]*.[0-9]*.[0-9]*' "${exclude[@]}" "$TAG^" 2>/dev/null) \ + || prev=$(git rev-list --max-parents=0 HEAD | tail -n1) + + apps=$(for f in apps/*/Dockerfile; do + jq -c -n --arg name "ev-node-$(basename "$(dirname "$f")")" --arg dockerfile "$f" '{name: $name, dockerfile: $dockerfile}' + done | jq -c -s .) + + { + echo "tag=$TAG" + echo "prerelease=$prerelease" + echo "latest=$latest" + echo "prev=$prev" + echo "apps=$apps" + } >> "$GITHUB_OUTPUT" + echo "::notice::tag=$TAG prerelease=$prerelease latest=$latest prev=$prev apps=$apps" + + docker: + name: Docker images + needs: prepare + permissions: + contents: read + packages: write + uses: ./.github/workflows/docker-build-push.yml + with: + image-tag: ${{ needs.prepare.outputs.tag }} + apps: ${{ needs.prepare.outputs.apps }} + latest: ${{ needs.prepare.outputs.latest == 'true' }} + + release: + name: GitHub Release + needs: [prepare, docker] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v7.0.1 + with: + fetch-depth: 0 + + - name: Generate release notes + uses: orhun/git-cliff-action@v4 + with: + version: v2.14.2 + config: cliff.toml + args: --strip header --tag ${{ needs.prepare.outputs.tag }} ${{ needs.prepare.outputs.prev }}..${{ needs.prepare.outputs.tag }} + env: + OUTPUT: NOTES.md + + - name: Append images and diff link + env: + TAG: ${{ needs.prepare.outputs.tag }} + PREV: ${{ needs.prepare.outputs.prev }} + APPS: ${{ needs.prepare.outputs.apps }} + REGISTRY: ghcr.io/${{ github.repository_owner }} + REPO: ${{ github.repository }} + run: | + { + echo + echo "## Docker images" + echo + jq -r --arg reg "$REGISTRY" --arg tag "$TAG" '.[] | "- `\($reg)/\(.name):\($tag)`"' <<<"$APPS" + echo + echo "**Full diff:** https://github.com/$REPO/compare/$PREV...$TAG" + } >> NOTES.md + + - name: Publish release + uses: softprops/action-gh-release@v3 + with: + tag_name: ${{ needs.prepare.outputs.tag }} + name: ev-node ${{ needs.prepare.outputs.tag }} + body_path: NOTES.md + draft: false + prerelease: ${{ needs.prepare.outputs.prerelease }} + make_latest: ${{ needs.prepare.outputs.latest }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 1867d7f3d1..85175e1723 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,22 @@ # Changelog - - -## [Unreleased] +## v1.4.1 ### Added - Add `p2p.announce_addresses` to set the multiaddrs advertised to peers, so nodes behind NAT or in containers without host networking stop advertising unreachable loopback/Docker bridge addresses [#3510](https://github.com/evstack/ev-node/pull/3510). +## v1.4.0 + +### Fixed + +- Reject DA signed data without metadata instead of dereferencing nil metadata during syncing [#3500](https://github.com/evstack/ev-node/pull/3500). +- Restrict app image releases to app module tags [#3497](https://github.com/evstack/ev-node/pull/3497). + ## v1.3.0 ### Added @@ -362,5 +366,3 @@ No changes from v1.1.0-rc.2. - Removed `LastCommitHash`, `ConsensusHash`, and `LastResultsHash` from the canonical header representation in favor of slim headers (BREAKING; legacy hashes now live under `Header.Legacy`) ([#2766](https://github.com/evstack/ev-node/pull/2766)) - -[Unreleased]: https://github.com/evstack/ev-node/compare/v1.0.0-beta.1...HEAD diff --git a/RELEASE.md b/RELEASE.md index 0c40391437..15d7eb9c35 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -2,126 +2,62 @@ This document covers the release process for ev-node components: -- **GitHub Releases** - Manual workflow to create draft releases with AI-generated release notes -- **Docker Image Releases** - Automated via GitHub workflows (for deployable applications) +- **ev-node releases** - Pushing a root semver tag builds the Docker images and publishes the GitHub Release - **Go Module Releases** - Manual process for library packages and dependencies --- -## GitHub Releases (Manual Workflow) +## Cutting a Release -### When to Use +Pushing a root tag such as `vX.Y.Z` or `vX.Y.Z-rc.1` runs `.github/workflows/release.yml`, which: -Create official GitHub releases with professionally formatted release notes for version tags. +1. Validates the tag (`v..[-PRERELEASE]`) and finds the previous release tag. Build metadata (`+BUILD`) is not supported: Docker tags cannot contain `+` +2. Builds and pushes multi-arch (amd64, arm64) images for every `apps/*/Dockerfile` to `ghcr.io/evstack/ev-node-:`; `:latest` moves only when the tag is the highest stable version +3. Generates release notes from the PR titles since the previous tag with [git-cliff](https://git-cliff.org) (`cliff.toml`) +4. Publishes the GitHub Release, with the image list and a full diff link -### Quick Steps +Tags with a `-` suffix (`-rc.1`, `-beta.1`) are published as prereleases: they never become the latest release and never move `:latest`. -```bash -# 1. Ensure CHANGELOG.md is updated for the version -# 2. Navigate to GitHub Actions -# 3. Run "Github Release" workflow -# 4. Enter tag (e.g., v1.2.3) -# 5. Review and publish the draft release -``` - -### How It Works - -The GitHub Release workflow (`.github/workflows/release-github.yml`) automates release note generation: - -1. **Validates Tag Format** - Ensures tag follows semantic versioning (e.g., `v1.2.3`, `v1.2.3-rc.4`) -2. **Extracts Version Info** - Parses version from tag and finds previous release -3. **Discovers Docker Images** - Lists all Docker images that will be included in the release -4. **Generates Release Notes** - Uses Claude AI to read CHANGELOG.md and create professional release notes -5. **Creates Draft Release** - Publishes a draft GitHub release for review - -### Release Notes Structure - -The workflow generates release notes with: - -- **Summary** - Overview of the release type and upgrade recommendations -- **Tested Upgrade Paths** - Version compatibility information -- **Changelog Sections**: - - Added (new features, with BREAKING changes highlighted) - - Changed (modifications, with BREAKING changes highlighted) - - Removed (deprecated features, with BREAKING changes highlighted) - - Fixed (bug fixes) -- **Docker Images** - List of all available Docker images for this release - -### Requirements - -- Tag must follow semantic versioning: `v..[-PRERELEASE][+BUILD]` - - Valid: `v1.2.3`, `v1.2.3-rc.4`, `v1.2.3-beta.1`, `v1.2.3-alpha.1+build.123` -- CHANGELOG.md must contain a section for the version being released -- `CLAUDE_CODE_OAUTH_TOKEN` secret must be configured in repository settings - -### Workflow Dispatch - -To trigger the workflow: - -1. Go to **GitHub → Actions → Github Release** -2. Click **Run workflow** -3. Enter the release tag (e.g., `v1.2.3`) -4. Click **Run workflow** - -The workflow will create a **draft release** that you can review and edit before publishing. - -### Best Practices - -- ✅ Update CHANGELOG.md before running the workflow -- ✅ Use clear, descriptive changelog entries -- ✅ Mark breaking changes explicitly in CHANGELOG.md -- ✅ Review the draft release before publishing -- ✅ Test upgrade paths and update release notes accordingly -- ✅ Ensure all Docker images are built and available - ---- - -## Docker Image Releases (Automated) - -### When to Use - -Release deployable applications (EVM nodes, test apps, etc.) as Docker images. - -### Quick Steps +### Steps ```bash -# 1. Ensure CI passes on main -# 2. Create and push tag -git tag evm/single/v0.2.0 -git push origin evm/single/v0.2.0 - -# 3. Monitor workflow -# GitHub → Actions → Release workflow +# 1. Make sure CI is green on the commit you are tagging (usually main) -# 4. Verify release -docker pull ghcr.io/evstack/ev-node-evm:v0.2.0 -``` +# 2. Optional: preview the release notes +git cliff --unreleased --tag vX.Y.Z +# or, without installing git-cliff +docker run --rm -v "$PWD":/app -w /app orhunp/git-cliff:2.14.2 --unreleased --tag vX.Y.Z -### Tag Format +# 3. Tag and push +git tag -a vX.Y.Z -m vX.Y.Z +git push origin vX.Y.Z -Use the hierarchical tag format: `{app-path}/v{major}.{minor}.{patch}` +# 4. Watch GitHub → Actions → Release +``` -**Examples:** +The release is published directly. Edit it afterwards on GitHub if you need to add context such as tested upgrade paths or operator steps. -- `apps/evm/v0.2.0` → Releases `apps/evm/` -- `apps/testapp/v1.0.0` → Releases `apps/testapp/` +### PR Titles Are the Changelog -### Automated Process +PRs are squash-merged, so each PR title becomes one release-note line. Titles must follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) (enforced by `semantic-pull-request.yml`): -When you push a tag, the release workflow automatically: +| Title prefix | Release notes section | +| --- | --- | +| `feat:` | Features | +| `fix:` | Bug fixes | +| `perf:` | Performance | +| `revert:` | Reverts | +| `chore:`, `docs:`, `test:`, `ci:`, `build:`, `refactor:`, `style:` | Not shown | +| `feat!:`, `fix(scope)!:`, any type with `!` | ⚠️ Breaking changes | -1. ✅ Validates tag format and app directory structure -2. ✅ Builds multi-platform Docker image (amd64, arm64) -3. ✅ Publishes to GitHub Container Registry (GHCR): - - Version tag: `ghcr.io/evstack/ev-node-{app}:v0.2.0` - - Latest tag: `ghcr.io/evstack/ev-node-{app}:latest` +- Add `!` before the colon to mark a **breaking** change. Breaking changes are always listed, even for otherwise hidden types such as `refactor!:`. +- An optional scope is shown in bold: `fix(p2p): ...` → **p2p:** ... +- Write titles for node operators: say what changed for them, not how it was implemented. +- Do not edit `CHANGELOG.md`; it is frozen. Release notes live on [GitHub Releases](https://github.com/evstack/ev-node/releases). -### Requirements +### Docker Images -- App directory must exist at `./apps/{app-path}/` -- Dockerfile must exist at `./apps/{app-path}/Dockerfile` -- Tag must match pattern `**/v*.*.*` -- CI must pass on main branch +Every app image uses the root version: tag `vX.Y.Z` publishes `ev-node-evm:vX.Y.Z`, `ev-node-testapp:vX.Y.Z`, `ev-node-loadgen:vX.Y.Z`, and so on. `apps/evm` and `apps/testapp` use `replace github.com/evstack/ev-node => ../..`, so their images are built against the tagged ev-node tree; `apps/loadgen` does not depend on ev-node and is built from its own sources at the tagged commit. App tags (`apps/evm/v*`, ...) are Go module tags only and do not build images. --- @@ -181,8 +117,9 @@ These packages have the most dependencies and should be released last: **Before Starting:** - Create a protected version branch (e.g., `v0` for major versions, `v0.3` for minor breaking changes) -- Ensure CHANGELOG.md is up to date with all changes properly categorized -- Remove all `replace` directives from go.mod files +- Pushing the root tag (`v0.3.0` below) also runs the release workflow: Docker images and the GitHub Release are published from that commit +- Remove `replace` directives from the library modules' go.mod files (`core`, root, `da`, `execution/evm`) +- Keep `replace github.com/evstack/ev-node => ../..` in `apps/*/go.mod`: the images built from the root tag rely on it to use the tagged tree, and no other module imports the apps #### Phase 1: Release Core @@ -250,39 +187,35 @@ go list -m github.com/evstack/ev-node/apps/evm@v0.3.0 ## Common Release Scenarios -### Scenario 1: Create GitHub Release +### Scenario 1: Stable Release ```bash -# 1. Update CHANGELOG.md with version changes -# 2. Commit and push changes -git add CHANGELOG.md -git commit -m "Update changelog for v1.2.3" -git push origin main - -# 3. Go to GitHub Actions → Github Release → Run workflow -# 4. Enter tag: v1.2.3 -# 5. Review draft release and publish +git cliff --unreleased --tag vX.Y.Z # optional preview +git tag -a vX.Y.Z -m vX.Y.Z +git push origin vX.Y.Z ``` -### Scenario 2: Release Single App (Docker Only) +### Scenario 2: Release Candidate ```bash -# Tag and push - automation handles the rest -git tag evm/v0.2.0 -git push origin evm/v0.2.0 +git tag -a vX.Y.Z-rc.1 -m vX.Y.Z-rc.1 +git push origin vX.Y.Z-rc.1 +# Published as a prerelease; :latest is not updated ``` -### Scenario 3: Release Multiple Apps +Release notes for an rc cover the changes since the previous tag (stable or rc); the `--unreleased` preview always starts at the last stable tag, so it shows more than an rc's notes. The final `vX.Y.Z` notes cover everything since the previous stable release, including all its rcs. -```bash -# Release apps independently -git tag evm/single/v0.2.0 -git tag testapp/v1.0.0 -git push origin evm/single/v0.2.0 testapp/v1.0.0 +### Scenario 3: Backport Release -# Each triggers its own workflow +```bash +git checkout v1.3.x +# cherry-pick fixes, wait for CI +git tag -a v1.3.1 -m v1.3.1 +git push origin v1.3.1 ``` +The previous tag is found by ancestry, so notes for `v1.3.1` diff against `v1.3.0`, not the newest tag on `main`. A backport that is not the highest stable version neither moves `:latest` nor becomes the latest GitHub Release. + ### Scenario 4: Full Go Module Release ```bash @@ -301,31 +234,28 @@ git tag apps/evm/v0.3.0 && git push origin apps/evm/v0.3.0 ### Scenario 5: Hotfix/Patch Release ```bash -# For Docker images - delete and recreate -git tag -d evm/single/v0.2.0 -git push origin :refs/tags/evm/single/v0.2.0 - -# Fix code, create new tag -git tag evm/single/v0.2.1 -git push origin evm/single/v0.2.1 +# Fix on main (or a backport branch), then cut a new patch version +git tag -a vX.Y.Z -m vX.Y.Z +git push origin vX.Y.Z -# For Go modules - create new patch version -# Do NOT delete Go module tags - create v0.3.1 instead +# Do NOT delete or move released tags: Go modules and images depend on them ``` +If a release workflow run fails for a transient reason, re-run it from the Actions tab: it overwrites the tag's images and updates the existing release. A re-run uses the tagged commit, so if the code needs a fix, cut a new patch version instead. + --- ## Verification -### Docker Image Release +### Docker Images and GitHub Release ```bash # Check workflow status # GitHub → Actions → Release # Pull and test image -docker pull ghcr.io/evstack/ev-node-evm:v0.2.0 -docker run ghcr.io/evstack/ev-node-evm:v0.2.0 --version +docker pull ghcr.io/evstack/ev-node-evm:vX.Y.Z +docker run ghcr.io/evstack/ev-node-evm:vX.Y.Z --version # Check GHCR # GitHub → Packages → ev-node-evm @@ -345,48 +275,25 @@ go get github.com/evstack/ev-node/core@v0.3.0 ## Troubleshooting -### GitHub Releases +### Release Workflow #### "Invalid tag format" error - Ensure tag follows semantic versioning: `v1.2.3` -- Check for typos or incorrect format - Valid examples: `v1.2.3`, `v1.2.3-rc.4`, `v1.2.3-beta.1` +- Delete the bad tag (`git push origin :refs/tags/`) and push a correct one -#### "Version not found in CHANGELOG.md" - -- Verify CHANGELOG.md contains a section for the version -- Check version format matches exactly (e.g., `v1.2.3` vs `1.2.3`) -- Ensure CHANGELOG.md is committed and pushed - -#### "Claude API error" +#### A PR is missing from the release notes -- Verify `CLAUDE_CODE_OAUTH_TOKEN` secret is configured -- Check repository permissions for GitHub Actions -- Review workflow logs for specific error messages +- `chore`, `docs`, `test`, `ci`, `build`, `refactor` and `style` commits are hidden unless marked breaking (`!`) +- Commits whose subject is not a conventional commit are dropped +- Edit the published release on GitHub to add the line -#### Empty or incomplete release notes +#### Docker build failed -- Ensure CHANGELOG.md has detailed entries for the version -- Check that changelog sections (Added, Changed, Fixed, etc.) are properly formatted -- Review the draft release and manually edit if needed - -### Docker Releases - -#### "App directory does not exist" - -- Ensure tag matches app path: `apps/evm/` → `apps/evm/v0.2.0` -- Check spelling and case sensitivity - -#### "Dockerfile not found" - -- Verify Dockerfile exists at `apps/{app-path}/Dockerfile` -- Check filename is exactly `Dockerfile` - -#### "Image not found" in tests - -- Wait for Docker build workflow to complete -- Check workflow dependencies in Actions tab +- Check the `Docker images` job logs in the Release run +- The GitHub Release is only published after all images are pushed; re-run the workflow for transient failures, or cut a new patch version if the code needs a fix +- Every `apps//Dockerfile` is built; an app without a Dockerfile is skipped ### Go Module Releases @@ -400,7 +307,7 @@ go get github.com/evstack/ev-node/core@v0.3.0 - Ensure all dependencies are released before dependent modules - Verify go.mod has correct versions -- Remove `replace` directives +- Remove `replace` directives from library modules (keep the `apps/*` ones) --- @@ -410,10 +317,10 @@ go get github.com/evstack/ev-node/core@v0.3.0 - ✅ All changes merged to `main` - ✅ CI workflow passes -- ✅ CHANGELOG.md updated +- ✅ PR titles describe the changes for operators (they become the release notes) - ✅ Documentation updated - ✅ Local testing complete -- ✅ Remove `replace` directives from go.mod files +- ✅ Remove `replace` directives from library go.mod files (keep the `apps/*` ones) ### Semantic Versioning @@ -428,19 +335,8 @@ While modules can have independent versions, keep major versions synchronized ac ### Tag Messages ```bash -# Good: Annotated tag with description -git tag -a evm/single/v0.2.0 -m "Release EVM single v0.2.0 - -Features: -- Added feature X -- Improved performance Y - -Bug fixes: -- Fixed issue Z -" - -# Avoid: Lightweight tag without description -git tag evm/single/v0.2.0 # Less informative +# Annotated tag; the release notes come from PR titles, not the tag message +git tag -a vX.Y.Z -m vX.Y.Z ``` --- @@ -454,7 +350,7 @@ git tag evm/single/v0.2.0 # Less informative 3. **Go Proxy Cache**: The Go module proxy may take up to 30 minutes to fully propagate new versions. Be patient and verify availability before proceeding to dependent modules. 4. **Rollback Plan**: - - **Docker images**: Can delete and recreate tags + - **Releases and Docker images**: Cut a new patch version; re-running a tag overwrites its images - **Go modules**: NEVER delete tags. Create a new patch version instead (e.g., v0.3.1) to avoid Go proxy issues. 5. **Protected Branches**: Create version branches (e.g., `v0`, `v0.3`) for maintaining release history and backporting fixes. diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000000..2e71bfb1cb --- /dev/null +++ b/cliff.toml @@ -0,0 +1,38 @@ +[changelog] +header = "" +trim = true +body = """ +{%- set breaking = commits | filter(attribute="breaking", value=true) -%} +{% if breaking | length > 0 %} +### ⚠️ Breaking changes +{% for commit in breaking %} +- {% if commit.scope %}**{{ commit.scope }}:** {% endif %}{{ commit.message | upper_first }} +{%- endfor %} +{% endif %} +{% for group, commits in commits | filter(attribute="breaking", value=false) | group_by(attribute="group") %} +### {{ group | striptags | trim | upper_first }} +{% for commit in commits %} +- {% if commit.scope %}**{{ commit.scope }}:** {% endif %}{{ commit.message | upper_first }} +{%- endfor %} +{% endfor %} +""" +postprocessors = [ + { pattern = '\(#([0-9]+)\)', replace = "([#${1}](https://github.com/evstack/ev-node/pull/${1}))" }, +] + +[git] +conventional_commits = true +filter_unconventional = true +protect_breaking_commits = true +filter_commits = false +tag_pattern = '^v[0-9]+\.[0-9]+\.[0-9]+' +ignore_tags = '-' +sort_commits = "newest" +commit_parsers = [ + { message = '^feat', group = "Features" }, + { message = '^fix', group = "Bug fixes" }, + { message = '^perf', group = "Performance" }, + { message = '^revert', group = "Reverts" }, + { message = '^(chore|docs|test|ci|style|build|refactor)', skip = true }, + { message = '.*', group = "Other" }, +]