Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
chore: replace manual release script with workflow (#4146)
Kyle Mendell189be498c23c
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex d5b6b39bc..c3b50ddcc 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -1,22 +1,144 @@name: Release New Arcane Versionon:- push:- tags:- - "v*.*.*"+ workflow_dispatch:+ inputs:+ bump:+ description: Version bump (auto uses conventional commits)+ type: choice+ default: auto+ options:+ - auto+ - major+ - minor+ - patch++concurrency:+ group: release+ cancel-in-progress: falsepermissions:- contents: write- packages: write- attestations: write- artifact-metadata: write- id-token: write+ contents: read++defaults:+ run:+ shell: bashjobs:- release:+ prepare:+ name: Prepare release+ runs-on: depot-ubuntu-latest+ outputs:+ version: ${{ steps.version.outputs.version }}+ tag: ${{ steps.version.outputs.tag }}+ commit: ${{ steps.commit.outputs.commit }}++ steps:+ - name: Require the main branch+ run: |+ if [[ "$GITHUB_REF" != refs/heads/main ]]; then+ echo "::error::Releases must be triggered from main."+ exit 1+ fi++ - name: Checkout release source+ uses: actions/checkout@v7+ with:+ ref: ${{ github.sha }}+ fetch-depth: 0+ persist-credentials: false++ - name: Setup git-cliff+ uses: taiki-e/install-action@v2+ with:+ tool: [email protected]++ - name: Calculate next version+ id: version+ env:+ BUMP: ${{ inputs.bump }}+ run: |+ version=$(git cliff --bumped-version --unreleased --offline --bump "$BUMP")+ version=${version#v}+ if [[ "$version" == "$(jq -r .version .arcane.json)" ]]; then+ echo "No commits requiring a version bump; no release created." >> "$GITHUB_STEP_SUMMARY"+ exit 0+ fi++ echo "version=$version" >> "$GITHUB_OUTPUT"+ echo "tag=v$version" >> "$GITHUB_OUTPUT"+ echo "Preparing release v$version from $GITHUB_SHA." >> "$GITHUB_STEP_SUMMARY"++ - name: Update version files and changelog+ if: steps.version.outputs.tag != ''+ env:+ VERSION: ${{ steps.version.outputs.version }}+ RELEASE_TAG: ${{ steps.version.outputs.tag }}+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: |+ build_time=$(date -u '+%Y-%m-%dT%H:%M:%SZ')+ jq --arg version "$VERSION" --arg revision "$GITHUB_SHA" --arg build_time "$build_time" \+ '.version = $version | .revision = $revision | .buildTime = $build_time' .arcane.json > "$RUNNER_TEMP/arcane.json"+ mv "$RUNNER_TEMP/arcane.json" .arcane.json+ jq --tab --arg version "$VERSION" '.version = $version' frontend/package.json > "$RUNNER_TEMP/package.json"+ mv "$RUNNER_TEMP/package.json" frontend/package.json+ git cliff --prepend CHANGELOG.md --tag "$RELEASE_TAG" --unreleased++ - name: Request App Token+ if: steps.version.outputs.tag != ''+ id: app-token+ uses: actions/create-github-app-token@v3+ with:+ client-id: ${{ secrets.ARCANE_APP_CLIENT_ID }}+ private-key: ${{ secrets.ARCANE_APP_PRIVATE_KEY }}+ owner: getarcaneapp+ repositories: arcane+ permission-contents: write++ - name: Commit and tag release+ if: steps.version.outputs.tag != ''+ id: commit+ env:+ VERSION: ${{ steps.version.outputs.version }}+ RELEASE_TAG: ${{ steps.version.outputs.tag }}+ GH_TOKEN: ${{ steps.app-token.outputs.token }}+ APP_SLUG: ${{ steps.app-token.outputs.app-slug }}+ run: |+ # Attribute the release commit to the app and authenticate the push with its installation token+ bot_name="$APP_SLUG[bot]"+ bot_id=$(gh api "users/$bot_name" --jq .id)+ git config user.name "$bot_name"+ git config user.email "[email protected]"+ gh auth setup-git++ git add .arcane.json frontend/package.json CHANGELOG.md+ git commit -m "release: $VERSION"+ for tag in "$RELEASE_TAG" "cli/$RELEASE_TAG" "types/$RELEASE_TAG" "backend/$RELEASE_TAG"; do+ git tag -a "$tag" -m "$VERSION"+ done++ # Publish all refs together so a concurrent main update cannot leave orphaned release tags+ git push --atomic origin HEAD:refs/heads/main \+ "refs/tags/$RELEASE_TAG" \+ "refs/tags/cli/$RELEASE_TAG" \+ "refs/tags/types/$RELEASE_TAG" \+ "refs/tags/backend/$RELEASE_TAG"+ echo "commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"++ build:+ name: Build and attest+ needs: prepare+ if: needs.prepare.outputs.tag != ''runs-on: depot-ubuntu-24.04-16+ permissions:+ contents: write+ packages: write+ attestations: write+ artifact-metadata: write+ id-token: writeenv:+ RELEASE_TAG: ${{ needs.prepare.outputs.tag }}MANAGER_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/arcaneMANAGER_IMAGE_ALIAS: ghcr.io/${{ github.repository_owner }}/managerAGENT_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/arcane-headless@@ -26,6 +148,7 @@ jobs:- name: Checkoutuses: actions/checkout@v7with:+ ref: ${{ needs.prepare.outputs.commit }}fetch-depth: 0- name: Setup Just@@ -94,6 +217,21 @@ jobs:repositories: arcane,homebrew-tappermission-contents: write+ - name: Create draft release+ env:+ GH_TOKEN: ${{ steps.app-token.outputs.token }}+ run: |+ # Reuse the draft when retrying a failed build+ if is_draft=$(gh release view "$RELEASE_TAG" --json isDraft --jq .isDraft); then+ if [[ "$is_draft" != true ]]; then+ echo "::error::Release $RELEASE_TAG is already published."+ exit 1+ fi+ else+ awk '/^## v[0-9]/ { if (found) exit; found=1; next } found' CHANGELOG.md > "$RUNNER_TEMP/release-notes.md"+ gh release create "$RELEASE_TAG" --verify-tag --title "$RELEASE_TAG" --notes-file "$RUNNER_TEMP/release-notes.md" --draft+ fi+- name: Run GoReleaseruses: goreleaser/goreleaser-action@v7with:@@ -122,8 +260,8 @@ jobs:- name: Resolve image digestsid: digestsrun: |- echo "manager=$(docker buildx imagetools inspect "${MANAGER_IMAGE_NAME}:${{ github.ref_name }}" --format '{{ .Manifest.Digest }}')" >> "$GITHUB_OUTPUT"- echo "agent=$(docker buildx imagetools inspect "${AGENT_IMAGE_NAME}:${{ github.ref_name }}" --format '{{ .Manifest.Digest }}')" >> "$GITHUB_OUTPUT"+ echo "manager=$(docker buildx imagetools inspect "${MANAGER_IMAGE_NAME}:${RELEASE_TAG}" --format '{{ .Manifest.Digest }}')" >> "$GITHUB_OUTPUT"+ echo "agent=$(docker buildx imagetools inspect "${AGENT_IMAGE_NAME}:${RELEASE_TAG}" --format '{{ .Manifest.Digest }}')" >> "$GITHUB_OUTPUT"- name: Container image attestation (manager)uses: actions/attest-build-provenance@v4@@ -153,13 +291,33 @@ jobs:subject-digest: ${{ steps.digests.outputs.agent }}push-to-registry: true+ publish:+ name: Publish release+ needs: [prepare, build]+ runs-on: depot-ubuntu-latest++ steps:+ - name: Request App Token+ id: app-token+ uses: actions/create-github-app-token@v3+ with:+ client-id: ${{ secrets.ARCANE_APP_CLIENT_ID }}+ private-key: ${{ secrets.ARCANE_APP_PRIVATE_KEY }}+ owner: getarcaneapp+ repositories: arcane+ permission-contents: write+- name: Publish releaseenv:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- run: gh release edit ${{ github.ref_name }} --draft=false+ GH_TOKEN: ${{ steps.app-token.outputs.token }}+ GH_REPO: ${{ github.repository }}+ RELEASE_TAG: ${{ needs.prepare.outputs.tag }}+ run: |+ gh release edit "$RELEASE_TAG" --draft=false+ echo "Published [$RELEASE_TAG](https://github.com/$GH_REPO/releases/tag/$RELEASE_TAG)." >> "$GITHUB_STEP_SUMMARY"update-website-release-assets:- needs: release+ needs: publishif: github.repository == 'getarcaneapp/arcane'runs-on: depot-ubuntu-24.04-16permissions: {}diff --git a/Justfile b/Justfileindex 807c994ce..8d02350ac 100644--- a/Justfile+++ b/Justfile@@ -970,217 +970,6 @@ remove target *args:# Release# ------------------------------------------------------------------------------# Create a new release (use --test to dry-run without writing anything)-[group('release')]-release *args:- #!/usr/bin/env bash- set -euo pipefail-- TEST=false- FORCE_MAJOR=false- VERBOSE=false- set -- {{ args }}- for arg in "$@"; do- case "$arg" in- --test)- TEST=true- ;;- --major)- FORCE_MAJOR=true- ;;- --verbose)- VERBOSE=true- ;;- *)- ;;- esac- done-- CLIFF_VERBOSE=""- if [ "$VERBOSE" == true ]; then- CLIFF_VERBOSE="-vv"- fi-- # Check if the script is being run from the root of the project- if [ ! -f .arcane.json ] || [ ! -f frontend/package.json ] || [ ! -f CHANGELOG.md ]; then- echo "Error: This command must be run from the root of the project."- exit 1- fi-- # Check if git cliff is installed- if ! command -v git cliff &>/dev/null; then- echo "Error: git cliff is not installed. Please install it from https://git-cliff.org/docs/installation."- exit 1- fi-- # Check if GitHub CLI is installed- if ! command -v gh &>/dev/null; then- echo "Error: GitHub CLI (gh) is not installed. Please install it and authenticate using 'gh auth login'."- exit 1- fi-- # Ensure local tags are up to date (don't fail if no remote)- git fetch --tags --quiet || true-- # Check if we're on the main branch (skip in test mode)- if [ "$TEST" == false ] && [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then- echo "Error: This command must be run on the main branch."- exit 1- fi-- # Read the current version from .arcane.json- VERSION=$(jq -r '.version' .arcane.json)-- # Function to increment the version- increment_version() {- local version=$1- local part=$2-- IFS='.' read -r -a parts <<<"$version"- if [ "$part" == "major" ]; then- parts[0]=$((parts[0] + 1))- parts[1]=0- parts[2]=0- elif [ "$part" == "minor" ]; then- parts[1]=$((parts[1] + 1))- parts[2]=0- elif [ "$part" == "patch" ]; then- parts[2]=$((parts[2] + 1))- fi- echo "${parts[0]}.${parts[1]}.${parts[2]}"- }-- # Determine the release type- if [ "$FORCE_MAJOR" == true ]; then- RELEASE_TYPE="major"- else- # Get the latest version tag (v*), ignoring non-version tags like 'next'- LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -n1 || echo "")- if [ -z "$LATEST_TAG" ]; then- RELEASE_TYPE="minor"- else- # Look only at commit subjects since the last tag (exclude merges)- SUBJECTS=$(git log --no-merges --format=%s "${LATEST_TAG}..HEAD")-- if echo "$SUBJECTS" | grep -Eiq '^feat(\([^)]+\))?: '; then- RELEASE_TYPE="minor"- elif echo "$SUBJECTS" | grep -Eiq '^fix(\([^)]+\))?: '; then- RELEASE_TYPE="patch"- else- echo "No 'fix' or 'feat' commits found since the latest release (${LATEST_TAG}). No new release will be created."- echo "Commits since ${LATEST_TAG}:"- git log --oneline --no-merges "${LATEST_TAG}..HEAD" || true- exit 0- fi- fi- fi-- # Increment the version based on the release type- if [ "$RELEASE_TYPE" == "major" ]; then- echo "Performing major release..."- NEW_VERSION=$(increment_version "$VERSION" major)- elif [ "$RELEASE_TYPE" == "minor" ]; then- echo "Performing minor release..."- NEW_VERSION=$(increment_version "$VERSION" minor)- elif [ "$RELEASE_TYPE" == "patch" ]; then- echo "Performing patch release..."- NEW_VERSION=$(increment_version "$VERSION" patch)- else- echo "Invalid release type. Please enter either 'major', 'minor', or 'patch'."- exit 1- fi-- if [ "$TEST" == true ]; then- echo "Test mode enabled: no files will be modified, no commits/tags/pushes/releases will be created."- else- # Confirm release creation- read -p "This will create a new $RELEASE_TYPE release with version $NEW_VERSION. Do you want to proceed? (y/n) " CONFIRM- if [[ "$CONFIRM" != "y" ]]; then- echo "Release process canceled."- exit 1- fi- fi-- LATEST_REVISION=$(git rev-parse HEAD)-- if [ "$TEST" == false ]; then- # Update .arcane.json file with the new version, revision, and build time- echo "Updating .arcane.json file..."- BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')- jq --arg version "$NEW_VERSION" --arg revision "$LATEST_REVISION" --arg build_time "$BUILD_TIME" \- '.version = $version | .revision = $revision | .buildTime = $build_time' .arcane.json > .arcane_tmp.json && mv .arcane_tmp.json .arcane.json- git add .arcane.json-- # Update version in frontend/package.json- jq --tab --arg new_version "$NEW_VERSION" '.version = $new_version' frontend/package.json > frontend/package_tmp.json && mv frontend/package_tmp.json frontend/package.json- git add frontend/package.json-- # Generate changelog- echo "Generating changelog..."- git cliff $CLIFF_VERBOSE --github-token=$(gh auth token) --prepend CHANGELOG.md --tag "v$NEW_VERSION" --unreleased- git add CHANGELOG.md-- # Commit the changes with the new version- git commit -m "release: $NEW_VERSION"-- # Create Git tags with the new version- TAG_MESSAGE="$NEW_VERSION"- git tag -a "v$NEW_VERSION" -m "$TAG_MESSAGE"- git tag -a "cli/v$NEW_VERSION" -m "$TAG_MESSAGE"- git tag -a "types/v$NEW_VERSION" -m "$TAG_MESSAGE"- git tag -a "backend/v$NEW_VERSION" -m "$TAG_MESSAGE"-- # Push the commit and tags in two steps to ensure the release workflow triggers on v* tag push- git push- git push origin "v$NEW_VERSION"- git push origin "cli/v$NEW_VERSION" "types/v$NEW_VERSION" "backend/v$NEW_VERSION"-- # Extract the changelog content for the latest release- echo "Extracting changelog content for version $NEW_VERSION..."- CHANGELOG=$(awk '/^## v[0-9]/ { if (found) exit; found=1; next } found' CHANGELOG.md)-- if [ -z "$CHANGELOG" ]; then- echo "Error: Could not extract changelog for version $NEW_VERSION."- exit 1- fi-- # Create the draft release on GitHub- echo "Creating GitHub draft release..."- gh release create "v$NEW_VERSION" --title "v$NEW_VERSION" --notes "$CHANGELOG" --draft-- if [ $? -eq 0 ]; then- echo "GitHub draft release created successfully."- else- echo "Error: Failed to create GitHub release."- exit 1- fi-- echo "Release process complete. New version: $NEW_VERSION"- else- echo "Test mode: skipping confirmation prompt and all write operations."- BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')- echo "Would update .arcane.json to version $NEW_VERSION, revision $LATEST_REVISION, and buildTime $BUILD_TIME"- echo "Would update frontend/package.json to version $NEW_VERSION"- echo "Generating changelog preview (no file write)..."- CHANGELOG=$(git cliff $CLIFF_VERBOSE --github-token=$(gh auth token) --tag "v$NEW_VERSION" --unreleased)-- if [ -z "$CHANGELOG" ]; then- echo "Error: Could not generate changelog preview for version $NEW_VERSION."- exit 1- fi-- echo "----- BEGIN CHANGELOG PREVIEW -----"- echo "$CHANGELOG"- echo "----- END CHANGELOG PREVIEW -----"- echo "Would commit: release: $NEW_VERSION"- echo "Would tag: v$NEW_VERSION, cli/v$NEW_VERSION, types/v$NEW_VERSION, backend/v$NEW_VERSION"- echo "Would push commit"- echo "Would push tag: v$NEW_VERSION"- echo "Would push tags: cli/v$NEW_VERSION, types/v$NEW_VERSION, backend/v$NEW_VERSION"- echo "Would create GitHub draft release v$NEW_VERSION"- echo "Test mode complete. No changes were written."- fi-# Compute the next semver next-image version (e.g. 2.4.0-next.1) from unreleased commits.# Bump rules: breaking -> major, feat -> minor, other included commits -> patch.# The -next.N counter continues from tags already published to GHCR; set@@ -1365,389 +1154,11 @@ _utils-list-fixes:echo "$FIX_COMMITS"fi- echo ""- echo ""- echo -e "${BLUE}=== How to create a hotfix release ===${NC}"- echo ""- echo "1. Start the hotfix release process:"- echo -e " ${GREEN}just utils hotfix${NC}"- echo ""- echo "2. Cherry-pick the fixes you want:"- echo -e " ${GREEN}git cherry-pick <commit-hash>${NC}"- echo ""- echo "3. Finalize the release:"- echo -e " ${GREEN}just utils hotfix${NC}"- echo ""-if [ "$TEST" == true ]; thenecho "Test mode: no changes were made."fi-[group('release')]-_utils-hotfix:- #!/usr/bin/env bash- set -euo pipefail-- TEST=false- VERBOSE=false- for arg in "$@"; do- case "$arg" in- --test)- TEST=true- ;;- --verbose)- VERBOSE=true- ;;- *)- ;;- esac- done-- CLIFF_VERBOSE=""- if [ "$VERBOSE" == true ]; then- set -x- CLIFF_VERBOSE="-vv"- fi-- # Colors for output- RED='\033[0;31m'- GREEN='\033[0;32m'- YELLOW='\033[1;33m'- BLUE='\033[0;34m'- NC='\033[0m' # No Color-- # Check if the script is being run from the root of the project- if [ ! -f .arcane.json ] || [ ! -f frontend/package.json ] || [ ! -f CHANGELOG.md ]; then- echo -e "${RED}Error: This command must be run from the root of the project.${NC}"- exit 1- fi-- CLIFF_CMD=""- if command -v git-cliff &>/dev/null; then- CLIFF_CMD="git-cliff"- elif git cliff --version &>/dev/null; then- CLIFF_CMD="git cliff"- else- echo "Error: git cliff is not installed. Please install it from https://git-cliff.org/docs/installation."- exit 1- fi-- # Check if GitHub CLI is installed- if ! command -v gh &>/dev/null; then- echo -e "${RED}Error: GitHub CLI (gh) is not installed. Please install it and authenticate using 'gh auth login'.${NC}"- exit 1- fi-- # Ensure local tags are up to date- git fetch --tags --quiet || true-- # Get the latest repo-wide release tag (ignore module tags like cli/v* or types/v*)- get_latest_repo_tag() {- local ref="${1:-HEAD}"- git tag -l 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname --merged "$ref" | head -n1- }-- cherry_pick_in_progress() {- git rev-parse -q --verify CHERRY_PICK_HEAD >/dev/null 2>&1- }-- has_unmerged_conflicts() {- [ -n "$(git diff --name-only --diff-filter=U)" ]- }-- working_tree_dirty() {- [ -n "$(git status --porcelain)" ]- }-- LATEST_TAG=$(get_latest_repo_tag "main")- if [ -z "$LATEST_TAG" ]; then- LATEST_TAG=$(get_latest_repo_tag "HEAD")- fi- if [ -z "$LATEST_TAG" ]; then- echo -e "${RED}Error: No previous release tag found.${NC}"- exit 1- fi-- echo -e "${GREEN}Latest release tag: ${LATEST_TAG}${NC}"-- # Extract version components from tag (format: v1.2.3)- VERSION=${LATEST_TAG#v}- IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"-- # Increment patch version for hotfix- NEW_PATCH=$((PATCH + 1))- NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"- NEW_TAG="v${NEW_VERSION}"-- echo -e "${YELLOW}Proposed hotfix version: ${NEW_TAG}${NC}"-- # Create release branch name- RELEASE_BRANCH="release/v${MAJOR}.${MINOR}"-- echo ""- echo -e "${YELLOW}=== Available fix commits since ${LATEST_TAG} ===${NC}"- echo ""-- # List all fix commits since the last tag- FIX_COMMITS=$(git log "${LATEST_TAG}..main" \- --oneline \- --no-merges \- --grep="^fix:" \- --grep="^hotfix:" \- --regexp-ignore-case \- --pretty=format:"%C(yellow)%h%Creset %s %C(dim)(%an)%Creset" || echo "")-- if [ -z "$FIX_COMMITS" ]; then- echo -e "${RED}No fix commits found since ${LATEST_TAG}${NC}"- else- echo "$FIX_COMMITS"- fi-- if [ "$TEST" == true ]; then- BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')- echo ""- echo "Test mode enabled: no changes will be made."- echo "Would create or reuse release branch: ${RELEASE_BRANCH}"- echo "Would cherry-pick selected commits from main."- echo "Would update .arcane.json to version ${NEW_VERSION}, revision <release-branch-head>, and buildTime ${BUILD_TIME}."- echo "Would generate changelog for ${NEW_TAG} and tag release."- echo "Would update main to version ${NEW_VERSION} after release."- exit 0- fi-- # Check if release branch already exists- if git show-ref --verify --quiet "refs/heads/${RELEASE_BRANCH}"; then- echo -e "${YELLOW}Release branch ${RELEASE_BRANCH} already exists.${NC}"- read -p "Do you want to use the existing branch? (y/n) " USE_EXISTING- if [[ "$USE_EXISTING" != "y" ]]; then- echo -e "${RED}Aborting.${NC}"- exit 1- fi- git checkout "${RELEASE_BRANCH}"- else- echo -e "${BLUE}Creating new release branch from ${LATEST_TAG}...${NC}"- git checkout -b "${RELEASE_BRANCH}" "${LATEST_TAG}"- fi-- if [ -z "$FIX_COMMITS" ]; then- echo ""- read -p "Do you want to continue anyway? (y/n) " CONTINUE- if [[ "$CONTINUE" != "y" ]]; then- git checkout main- git branch -D "${RELEASE_BRANCH}" 2>/dev/null || true- exit 0- fi- else- echo ""- fi-- echo -e "${BLUE}=== Cherry-pick Instructions ===${NC}"- echo ""- echo "You can now cherry-pick the commits you want to include in this hotfix."- echo ""- echo "Example:"- echo -e " ${GREEN}git cherry-pick abc123 def456${NC}"- echo ""- echo "Or pick them one at a time and continue when done."- echo ""-- # Interactive cherry-pick loop- while true; do- echo ""- read -p "Enter commit hash to cherry-pick (or 'done' to finish, 'list' to see commits again, 'quit' to abort): " INPUT-- case "$INPUT" in- done)- if cherry_pick_in_progress || has_unmerged_conflicts; then- echo -e "${RED}A cherry-pick is still in progress.${NC}"- echo -e "Run ${YELLOW}git add <resolved-files>${NC} and ${YELLOW}git cherry-pick --continue${NC} first,"- echo -e "or run ${YELLOW}git cherry-pick --abort${NC} to discard it."- continue- fi- break- ;;- quit)- echo -e "${YELLOW}Aborting hotfix release...${NC}"- if cherry_pick_in_progress || has_unmerged_conflicts || working_tree_dirty; then- echo -e "${YELLOW}Working tree is not clean; staying on ${RELEASE_BRANCH}.${NC}"- echo -e "Resolve the cherry-pick manually with ${GREEN}git cherry-pick --continue${NC} or ${GREEN}git cherry-pick --abort${NC}."- exit 1- fi- git checkout main- read -p "Delete release branch ${RELEASE_BRANCH}? (y/n) " DELETE_BRANCH- if [[ "$DELETE_BRANCH" == "y" ]]; then- git branch -D "${RELEASE_BRANCH}" 2>/dev/null || true- fi- exit 0- ;;- list)- echo ""- echo -e "${YELLOW}=== Available fix commits ===${NC}"- echo "$FIX_COMMITS"- continue- ;;- "")- continue- ;;- *)- # Try to cherry-pick the commit(s)- if git cherry-pick $INPUT; then- echo -e "${GREEN}✓ Successfully cherry-picked: $INPUT${NC}"- else- echo -e "${RED}✗ Cherry-pick failed. Resolve conflicts and run:${NC}"- echo -e " ${YELLOW}git add <resolved-files>${NC}"- echo -e " ${YELLOW}git cherry-pick --continue${NC}"- echo ""- read -p "Press Enter when resolved (or 'abort' to skip this commit): " RESOLVE- if [[ "$RESOLVE" == "abort" ]]; then- git cherry-pick --abort- echo -e "${YELLOW}Cherry-pick aborted${NC}"- elif cherry_pick_in_progress || has_unmerged_conflicts; then- echo -e "${YELLOW}Cherry-pick is still in progress.${NC}"- echo -e "Run ${GREEN}git add <resolved-files>${NC} and ${GREEN}git cherry-pick --continue${NC}, then choose another action."- fi- fi- ;;- esac- done-- # Check if any commits were added- BASE_TAG=$(get_latest_repo_tag "HEAD")- if [ -z "$BASE_TAG" ]; then- BASE_TAG="$LATEST_TAG"- fi- COMMITS_ADDED=$(git rev-list "${BASE_TAG}..HEAD" --count)-- if [ "$COMMITS_ADDED" -eq 0 ]; then- echo -e "${RED}No commits were cherry-picked. Aborting hotfix release.${NC}"- if cherry_pick_in_progress || has_unmerged_conflicts || working_tree_dirty; then- echo -e "${YELLOW}Working tree is not clean; staying on ${RELEASE_BRANCH}.${NC}"- echo -e "Resolve the cherry-pick manually with ${GREEN}git cherry-pick --continue${NC} or ${GREEN}git cherry-pick --abort${NC}."- exit 1- fi- git checkout main- git branch -D "${RELEASE_BRANCH}" 2>/dev/null || true- exit 0- fi-- echo ""- echo -e "${YELLOW}=== Commits in this hotfix release ===${NC}"- git log "${BASE_TAG}..HEAD" --oneline --no-merges- echo ""-- # Confirm release- read -p "Create hotfix release ${NEW_TAG}? (y/n) " CONFIRM- if [[ "$CONFIRM" != "y" ]]; then- echo -e "${RED}Release canceled.${NC}"- echo ""- echo "You are still on branch ${RELEASE_BRANCH}."- echo "To continue later, run this command again or finalize manually."- exit 1- fi-- echo ""- echo -e "${BLUE}Finalizing hotfix release ${NEW_TAG}...${NC}"-- # Update .arcane.json file with the new version, revision, and build time- LATEST_REVISION=$(git rev-parse HEAD)- BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')- jq --arg version "$NEW_VERSION" --arg revision "$LATEST_REVISION" --arg build_time "$BUILD_TIME" \- '.version = $version | .revision = $revision | .buildTime = $build_time' .arcane.json > .arcane_tmp.json && mv .arcane_tmp.json .arcane.json- git add .arcane.json-- # Update version in frontend/package.json- jq --arg new_version "$NEW_VERSION" '.version = $new_version' frontend/package.json > frontend/package_tmp.json && mv frontend/package_tmp.json frontend/package.json- git add frontend/package.json-- # Generate changelog for ONLY the fixes in this release branch- echo -e "${BLUE}Generating changelog for hotfix...${NC}"-- $CLIFF_CMD $CLIFF_VERBOSE \- --github-token=$(gh auth token) \- --prepend CHANGELOG.md \- --tag "$NEW_TAG" \- --unreleased-- git add CHANGELOG.md-- # Commit the version bump and changelog- git commit \- -m "release: ${NEW_VERSION} (hotfix)" \- -m "Hotfix release containing critical bug fixes." \- -m "Base version: ${BASE_TAG}" \- -m "See CHANGELOG.md for details."-- # Create annotated tag- git tag -a "$NEW_TAG" \- -m "Release ${NEW_TAG} (Hotfix)" \- -m "Hotfix release based on ${BASE_TAG}" \- -m "See CHANGELOG.md for details."-- git tag "cli/${NEW_TAG}"- git tag "types/${NEW_TAG}"- git tag "backend/${NEW_TAG}"-- echo ""- echo -e "${GREEN}✅ Hotfix release ${NEW_TAG} created successfully!${NC}"- echo ""-- # Push the commit and tags in two steps to ensure the release workflow triggers on v* tag push- git push- git push origin "$NEW_TAG"- git push origin "cli/${NEW_TAG}" "types/${NEW_TAG}" "backend/${NEW_TAG}"-- # Extract the changelog content for the latest release- echo "Extracting changelog content for version $NEW_TAG..."- CHANGELOG=$(awk '/^## v[0-9]/ { if (found) exit; found=1; next } found' CHANGELOG.md)-- if [ -z "$CHANGELOG" ]; then- echo -e "${RED}Error: Could not extract changelog for version $NEW_TAG.${NC}"- exit 1- fi-- # Create the draft release on GitHub- echo "Creating GitHub draft release..."- gh release create "$NEW_TAG" --title "${NEW_TAG} (Hotfix)" --notes "$CHANGELOG" --draft-- if [ $? -eq 0 ]; then- echo "GitHub draft release created successfully."- else- echo -e "${RED}Error: Failed to create GitHub release.${NC}"- exit 1- fi-- echo "Release process complete. New version: $NEW_TAG"- echo ""- echo -e "${YELLOW}Note: Hotfix release created from ${BASE_TAG} on ${RELEASE_BRANCH}${NC}"- echo "The fix commits are already on main, this release just tags them without unreleased features."- echo ""- echo "Review the draft at: https://github.com/ofkm/arcane/releases"- echo ""-- # Update main branch with the new version files- echo -e "${BLUE}Updating main branch with version ${NEW_VERSION}...${NC}"- git checkout main- git pull origin main --quiet-- # Update .arcane.json file with the new version, revision, and build time- jq --arg version "$NEW_VERSION" --arg revision "$LATEST_REVISION" --arg build_time "$BUILD_TIME" \- '.version = $version | .revision = $revision | .buildTime = $build_time' .arcane.json > .arcane_tmp.json && mv .arcane_tmp.json .arcane.json-- # Update version in frontend/package.json- jq --arg new_version "$NEW_VERSION" '.version = $new_version' frontend/package.json > frontend/package_tmp.json && mv frontend/package_tmp.json frontend/package.json-- # Copy the updated CHANGELOG.md from the release branch- git checkout "${RELEASE_BRANCH}" -- CHANGELOG.md-- # Commit the version updates to main- git add .arcane.json frontend/package.json CHANGELOG.md- git commit -m "chore: bump version to ${NEW_VERSION} after hotfix release"- git push origin main-- echo -e "${GREEN}✅ Main branch updated with version ${NEW_VERSION}${NC}"- echo ""--# Utils targets. Valid: "list-feats", "list-fixes", "hotfix".+# Utils targets. Valid: "list-feats", "list-fixes".[group('release')]utils target *args:@just "_utils-{{ target }}" {{ args }}diff --git a/cliff.toml b/cliff.tomlindex fc636b0f1..185e7e8d6 100644--- a/cliff.toml+++ b/cliff.toml@@ -11,39 +11,39 @@ filter_unconventional = truetag_pattern = "v[0-9]*"commit_preprocessors = [{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" }]commit_parsers = [- { message = "^feat\\(cli\\)", group = "<!-- 01 --> CLI - New features" },- { message = "^feat", group = "<!-- 00 --> New features" },+ { message = "^feat\\(cli\\)", group = "CLI - New features" },+ { message = "^feat", group = "New features" },- { message = "^fix\\(cli\\)", group = "<!-- 11 --> CLI - Bug fixes" },- { message = "^fix", group = "<!-- 10 --> Bug fixes" },+ { message = "^fix\\(cli\\)", group = "CLI - Bug fixes" },+ { message = "^fix", group = "Bug fixes" },- { message = "^perf\\(cli\\)", group = "<!-- 21 --> CLI - Performance improvements" },- { message = "^perf", group = "<!-- 20 --> Performance improvements" },+ { message = "^perf\\(cli\\)", group = "CLI - Performance improvements" },+ { message = "^perf", group = "Performance improvements" },- { message = "^docs\\(cli\\)", group = "<!-- 31 --> CLI - Documentation", default_scope = "other" },- { message = "^docs", group = "<!-- 30 --> Documentation", default_scope = "other" },+ { message = "^docs\\(cli\\)", group = "CLI - Documentation", default_scope = "other" },+ { message = "^docs", group = "Documentation", default_scope = "other" },{ message = "^chore\\(deps\\)", skip = true },- { message = "^chore", skip = true },- { message = "^release", skip = true },- { message = "update translations via Crowdin", skip = true },- { message = ".*", group = "<!-- 50 --> Other", default_scope = "other"},+ { message = "^chore", skip = true },+ { message = "^release", skip = true },+ { message = "update translations via Crowdin", skip = true },+ { message = ".*", group = "Other", default_scope = "other" },]filter_commits = false+[bump]+no_increment_regex = "^(chore|ci|docs|refactor|style|test)"+[changelog]+format = truetrim = truebody = """## {{ version | default(value="Unknown Version") }}-{% for group, commits in commits | group_by(attribute="group") %}-### {{ group | striptags | trim | upper_first }}-{% for commit in commits %}- * {{ commit.message }} \- {%- if commit.remote.pr_number -%}- ([#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) by @{{ commit.remote.username | default(value=commit.author.name) }})- {%- else -%}- ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}) by @{{ commit.remote.username | default(value=commit.author.name) }})- {%- endif -%}+{% for entry in commits | commit_groups(groups=["New features", "CLI - New features", "Bug fixes", "CLI - Bug fixes", "Performance improvements", "CLI - Performance improvements", "Documentation", "CLI - Documentation", "Other"]) %}+### {{ entry.group }}+{% for commit in entry.commits %}+ - {{ commit.message | trim }} \+ {%- if commit.remote.pr_number %} ([#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) by @{{ commit.remote.pr_author | default(value=commit.remote.username) | default(value=commit.author.name) }}){%- else %} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}) by @{{ commit.remote.username | default(value=commit.author.name) }}){%- endif -%}{% endfor %}{% endfor %}{% if version %}