Verified Commit adfd63c1 authored by Hayley Swimelar's avatar Hayley Swimelar Committed by GitLab
Browse files

fix(release): use inline presetConfig for release-notes-generator

parent b8e9f278
Loading
Loading
Loading
Loading

.changelog.config.js

0 → 100644
+46 −0
Changes for .changelog.config.js: 46 added lines, 0 removed lines.
Original line number Diff line number Diff line
// Type configuration for conventional-changelog-cli
//
// NOTE: The type-to-section mapping is also defined in .releaserc.yml for
// semantic-release. If you update the types here, update them there too.

const typeOrder = ['feat', 'fix', 'perf', 'revert', 'build', 'refactor']

const typeMap = {
  feat: '✨ Features ✨',
  fix: '🐛 Bug Fixes 🐛',
  perf: '⚡️ Performance Improvements ⚡️',
  revert: '⏮️️ Reverts ⏮️️',
  build: '⚙️ Build ⚙️',
  refactor: '♻️ Refactors ♻️'
}

// Reverse lookup: section title -> original type
const titleToType = Object.fromEntries(
  Object.entries(typeMap).map(([k, v]) => [v, k])
)

module.exports = {
  writerOpts: {
    transform: (commit, context) => {
      if (!commit.type || !typeMap[commit.type]) {
        return null
      }

      commit.type = typeMap[commit.type]

      if (typeof commit.hash === 'string') {
        commit.shortHash = commit.hash.substring(0, 7)
      }

      return commit
    },
    groupBy: 'type',
    commitGroupsSort: (a, b) => {
      // Sort by the original type order, not alphabetically
      const aType = titleToType[a.title] || a.title
      const bType = titleToType[b.title] || b.title
      return typeOrder.indexOf(aType) - typeOrder.indexOf(bType)
    },
    commitsSort: ['scope', 'subject']
  }
}

.conventional-changelog.js

deleted100644 → 0
+0 −37
Changes for .conventional-changelog.js: 0 added lines, 37 removed lines.
Original line number Diff line number Diff line
module.exports = {
  preset: "conventionalcommits",
  presetConfig: {
    types: [
      {
        type: "feat",
        section: "✨ Features ✨",
        hidden: false,
      },
      {
        type: "fix",
        section: "🐛 Bug Fixes 🐛",
        hidden: false,
      },
      {
        type: "perf",
        section: "⚡️ Performance Improvements ⚡️",
        hidden: false,
      },
      {
        type: "revert",
        section: "⏮️️ Reverts ⏮️️",
        hidden: false,
      },
      {
        type: "build",
        section: "⚙️ Build ⚙️",
        hidden: false,
      },
      {
        type: "refactor",
        section: "♻️ Refactors ♻️",
        hidden: false,
      },
    ],
  },
};
+1 −0
Changes for .gitlab-ci.yml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ include:
  - local: .gitlab/ci/test.yml
  - local: .gitlab/ci/integration.yml
  - local: .gitlab/ci/release.yml
  - local: .gitlab/ci/release_common.yml
  - local: .gitlab/ci/release_prepare.yml
  - local: .gitlab/ci/release_tag.yml
  - local: .gitlab/ci/release_backport.yml
+16 −21
Changes for .gitlab/ci/release_backport.yml: 16 added lines, 21 removed lines.
Original line number Diff line number Diff line
# .gitlab/ci/release_backport.yml
# Manual backport helper: branch from BASE_TAG, cherry-pick SHAs, regenerate CHANGELOG,
# create release commit, tag v<NEW_VERSION>-gitlab.
# - RESUME:            Optional true/false. If true, the job resumes on BRANCH_NAME after you manually resolve
#                      cherry-pick conflicts and push. Defaults to "false".
# - TAG:               Optional. The tag to create, e.g., v4.13.1-gitlab. Defaults to "v${NEW_VERSION}-gitlab".

# - BASE_TAG:          Required. The base tag to branch from, e.g., v4.13.0-gitlab.
# - CHERRY_PICK_SHAS:  Required. The SHAs to cherry-pick, space/comma/newline-separated.
# - NEW_VERSION:       Required. The new version to release, e.g., 4.13.1.
#
# Required variables:
#   - BASE_TAG:          The base tag to branch from, e.g., v4.13.0-gitlab.
#   - CHERRY_PICK_SHAS:  The SHAs to cherry-pick, space/comma/newline-separated.
#   - NEW_VERSION:       The new version to release, e.g., 4.13.1.
#
# Optional variables:
#   - RESUME:      If true, resumes on BRANCH_NAME after manual conflict resolution. Default: false.
#   - TAG:         The tag to create. Default: v${NEW_VERSION}-gitlab.
#   - BRANCH_NAME: The branch name. Default: release/v${NEW_VERSION}.

release:backport:
  stage: release
  image: node:20-alpine
  resource_group: release
  needs: []
  extends: .release_push_base
  rules:
    - when: manual
      allow_failure: true
  variables:
    GIT_STRATEGY: fetch
    GIT_DEPTH: "0"
    REPO_URL: "https://oauth2:${RELEASE_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
  before_script:
    - apk add --no-cache git bash curl jq
    - git config --global user.email "project_13831684_bot_1f10d664ae815e69d247c8cd4c319058@noreply.${CI_SERVER_HOST}"
    - git config --global user.name "Registry Release Bot"
  environment:
    # only users with access to the release environment (i.e. maintainers) can run this manual job
    name: release
@@ -78,7 +69,11 @@ release:backport:
      # Release commit (skip if already present)
      if ! git log -1 --pretty=%s | grep -Eq "^chore\\(release\\):[[:space:]]*${NEW_VERSION}$"; then
        echo '{"name":"container-registry","version":"'"${NEW_VERSION}"'"}' > /tmp/pkg.json
        npx conventional-changelog-cli@3 -p ./.conventional-changelog.js -k /tmp/pkg.json -i CHANGELOG.md -s -r 1
        npx conventional-changelog-cli@${CHANGELOG_CLI_VERSION} \
          -n ./.changelog.config.js \
          -p conventionalcommits \
          -k /tmp/pkg.json \
          -i CHANGELOG.md -s -r 1
        git add CHANGELOG.md
        git commit -m "chore(release): ${NEW_VERSION}"
      fi
+41 −0
Changes for .gitlab/ci/release_common.yml: 41 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Common configuration for release jobs
# This file defines shared settings to reduce duplication across release jobs.

# Pinned package versions - update these when upgrading
variables:
  SEMANTIC_RELEASE_VERSION: "21"
  COMMIT_ANALYZER_VERSION: "10"
  RELEASE_NOTES_VERSION: "11"
  SR_CHANGELOG_VERSION: "6"
  SR_GIT_VERSION: "10"
  CONVENTIONALCOMMITS_VERSION: "6"
  CHANGELOG_CLI_VERSION: "3"

# Base configuration for all release jobs
.release_base:
  stage: release
  image: node:20-alpine
  needs: []
  variables:
    GIT_STRATEGY: fetch
    GIT_DEPTH: "0"

# Extended base for jobs that push changes (uses bot identity)
.release_push_base:
  extends: .release_base
  resource_group: release
  variables:
    GITLAB_TOKEN: $RELEASE_TOKEN
    REPO_URL: "https://oauth2:${RELEASE_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
  before_script:
    - apk add --no-cache git curl bash jq
    - git config --global user.email "project_13831684_bot_1f10d664ae815e69d247c8cd4c319058@noreply.${CI_SERVER_HOST}"
    - git config --global user.name "Registry Release Bot"

# Base for dry-run/test jobs (uses test identity)
.release_test_base:
  extends: .release_base
  before_script:
    - apk add --no-cache git curl bash jq
    - git config --global user.email "test@example.com"
    - git config --global user.name "Test"
Loading