diff --git a/astro.config.js b/astro.config.js index ca4035b..f9b5a74 100644 --- a/astro.config.js +++ b/astro.config.js @@ -47,12 +47,22 @@ export default defineConfig({ label: "Usage", items: [ { slug: "usage/getting-started" }, - { slug: "usage/installation" }, - { slug: "usage/ci-configuration" }, { slug: "usage/configuration" }, - { slug: "usage/plugins" }, - { slug: "usage/workflow-configuration" }, - { slug: "usage/shareable-configurations" }, + { slug: "usage/ci-configuration" }, + { slug: "usage/running" }, + ], + }, + { + label: "Foundations", + items: [ + { slug: "foundation", label: "Overview" }, + { slug: "foundation/how-it-works" }, + { slug: "foundation/release-steps" }, + { slug: "foundation/considerations" }, + { slug: "foundation/supported-branching" }, + { slug: "foundation/workflow-configuration" }, + { slug: "foundation/plugins" }, + { slug: "foundation/shareable-configurations" }, ], }, { @@ -68,25 +78,28 @@ export default defineConfig({ { label: "CI Configurations", items: [ - { slug: "recipes/ci-configurations" }, - { slug: "recipes/ci-configurations/circleci-workflows" }, - { slug: "recipes/ci-configurations/travis" }, - { slug: "recipes/ci-configurations/gitlab-ci" }, + { slug: "recipes/ci-configurations", label: "Overview" }, { slug: "recipes/ci-configurations/github-actions" }, + { slug: "recipes/ci-configurations/gitlab-ci" }, + { + slug: "recipes/ci-configurations/circleci-workflows", + label: "CircleCI Workflows", + }, + { slug: "recipes/ci-configurations/travis" }, { slug: "recipes/ci-configurations/jenkins-ci" }, ], }, { label: "Git Hosted Services", items: [ - { slug: "recipes/git-hosted-services" }, + { slug: "recipes/git-hosted-services", label: "Overview" }, { slug: "recipes/git-hosted-services/git-auth-ssh-keys" }, ], }, { label: "Release Workflow", items: [ - { slug: "recipes/release-workflow" }, + { slug: "recipes/release-workflow", label: "Overview" }, { slug: "recipes/release-workflow/distribution-channels" }, { slug: "recipes/release-workflow/maintenance-releases" }, { slug: "recipes/release-workflow/pre-releases" }, diff --git a/src/components/PluginCard.astro b/src/components/PluginCard.astro new file mode 100644 index 0000000..65ac585 --- /dev/null +++ b/src/components/PluginCard.astro @@ -0,0 +1,181 @@ +--- +type PluginStep = { + verifyConditions?: string; + analyseCommits?: string; + verifyRelease?: string; + generateNotes?: string; + prepare?: string; + publish?: string; + addChannel?: string; + success?: string; + fail?: string; +}; + +interface Props { + name: string; + url: string; + description?: string; + steps?: PluginStep; +} + +const { name, url, description, steps = {} } = Astro.props; +const stepEntries = Object.entries(steps); +--- + +
+
+

{name}

+ + + + + + + +
+ {description &&

{description}

} + { + stepEntries.length > 0 && ( +
+ {stepEntries.map(([stepName, descriptionription]) => ( +
+ +
{stepName}
+ + + +
+
+
+ ))} +
+ ) + } +
+ + diff --git a/src/content/docs/developer-guide/js-api.md b/src/content/docs/developer-guide/js-api.md index e37786e..01362d3 100644 --- a/src/content/docs/developer-guide/js-api.md +++ b/src/content/docs/developer-guide/js-api.md @@ -74,7 +74,7 @@ try { ### semanticRelease(\[options], \[config]) => Promise -Run **semantic-release** and returns a `Promise` that resolves to a [Result](js-api.md#result) object. +Run **semantic-release** and returns a `Promise` that resolves to a [Result](#result) object. #### options @@ -82,9 +82,9 @@ Type: `Object` **semantic-release** options. -Can be used to set any [core option](../usage/configuration.md#configuration) or [plugin options](../usage/plugins.md#configuration). +Can be used to set any [core option](/usage/configuration#option) or [plugin options](/usage/configuration/#plugins). -Each option, will take precedence over options configured in the [configuration file](../usage/configuration.md#configuration) and [shareable configurations](../usage/configuration.md#extends). +Each option, will take precedence over options configured in the [configuration file](/usage/configuration#configuration-file) and [shareable configurations](/usage/configuration#extends). #### config @@ -132,7 +132,7 @@ It allows to configure **semantic-release** to write errors to a specific stream Type: `Object` `Boolean`
-An object with [`lastRelease`](js-api.md#lastrelease), [`nextRelease`](js-api.md#nextrelease), [`commits`](js-api.md#commits) and [`releases`](js-api.md#releases) if a release is published or `false` if no release was published. +An object with [`lastRelease`](#lastrelease), [`nextRelease`](#nextrelease), [`commits`](#commits) and [`releases`](#releases) if a release is published or `false` if no release was published. #### lastRelease diff --git a/src/content/docs/extending/plugins-list.md b/src/content/docs/extending/plugins-list.md deleted file mode 100644 index 87e5aec..0000000 --- a/src/content/docs/extending/plugins-list.md +++ /dev/null @@ -1,229 +0,0 @@ ---- -title: "Plugins" ---- - -## Official plugins - -- [@semantic-release/commit-analyzer](https://github.com/semantic-release/commit-analyzer) - - **Note**: this is already part of semantic-release and does not have to be installed separately - - `analyzeCommits`: Determine the type of release by analyzing commits with [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) -- [@semantic-release/release-notes-generator](https://github.com/semantic-release/release-notes-generator) - - **Note**: this is already part of semantic-release and does not have to be installed separately - - `generateNotes`: Generate release notes for the commits added since the last release with [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) -- [@semantic-release/github](https://github.com/semantic-release/github) - - **Note**: this is already part of semantic-release and does not have to be installed separately - - `verifyConditions`: Verify the presence and the validity of the GitHub authentication and release configuration - - `publish`: Publish a [GitHub release](https://help.github.com/articles/about-releases) - - `success`: Add a comment to GitHub issues and pull requests resolved in the release - - `fail`: Open a GitHub issue when a release fails -- [@semantic-release/npm](https://github.com/semantic-release/npm) - - **Note**: this is already part of semantic-release and does not have to be installed separately - - `verifyConditions`: Verify the presence and the validity of the npm authentication and release configuration - - `prepare`: Update the package.json version and create the npm package tarball - - `publish`: Publish the package on the npm registry -- [@semantic-release/gitlab](https://github.com/semantic-release/gitlab) - - `verifyConditions`: Verify the presence and the validity of the GitLab authentication and release configuration - - `publish`: Publish a [GitLab release](https://docs.gitlab.com/ee/user/project/releases/) -- [@semantic-release/git](https://github.com/semantic-release/git) - - `verifyConditions`: Verify the presence and the validity of the Git authentication and release configuration - - `prepare`: Push a release commit and tag, including configurable files -- [@semantic-release/changelog](https://github.com/semantic-release/changelog) - - `verifyConditions`: Verify the presence and the validity of the configuration - - `prepare`: Create or update the changelog file in the local project repository -- [@semantic-release/exec](https://github.com/semantic-release/exec) - - `verifyConditions`: Execute a shell command to verify if the release should happen - - `analyzeCommits`: Execute a shell command to determine the type of release - - `verifyRelease`: Execute a shell command to verifying a release that was determined before and is about to be published - - `generateNotes`: Execute a shell command to generate the release note - - `prepare`: Execute a shell command to prepare the release - - `publish`: Execute a shell command to publish the release - - `success`: Execute a shell command to notify of a new release - - `fail`: Execute a shell command to notify of a failed release -- [@semantic-release/apm](https://github.com/semantic-release/apm) - - `verifyConditions`: Verify the presence of the `ATOM_ACCESS_TOKEN` environment variable and the [`apm`](https://github.com/atom/apm) CLI - - `prepare`: Update the `package.json` version with [`npm version`](https://docs.npmjs.com/cli/version) - - `publish`: Publish the [Atom package](https://flight-manual.atom.io/hacking-atom/sections/publishing) - -## Community plugins - -[Open a Pull Request](https://github.com/semantic-release/semantic-release/blob/master/CONTRIBUTING.md#submitting-a-pull-request) to add your plugin to the list. - -- [semantic-release-slack-bot](https://github.com/juliuscc/semantic-release-slack-bot) - - `verifyConditions`: Verify that the environment variable `SLACK_WEBHOOK` has been defined. - - `success`: Publish a message about the success to a slack channel. - - `fail`: Optionally publish a message about failure to a slack channel. -- [semantic-release-docker](https://github.com/felixfbecker/semantic-release-docker) - - `verifyConditions`: Verify that all needed configuration is present and login to the Docker registry. - - `publish`: Tag the image specified by `name` with the new version, push it to Docker Hub and update the latest tag -- [@semantic-release-plus/docker](https://github.com/semantic-release-plus/semantic-release-plus/tree/master/packages/plugins/docker) - - `verifyConditions`: Verify that all needed configuration is present and login to the configured docker registry. - - `publish`: Tag the image specified by `name` with the new version and channel and push it to the configured docker registry. - - `addChannel`: Updates a release published on one channel with the destinations channel tag and pushes to the registry i.e.: next to latest. -- [semantic-release-gcr](https://github.com/carlos-cubas/semantic-release-gcr) - - `verifyConditions`: Verify that all needed configuration is present and login to the Docker registry - - `publish`: Tag the image specified by `name` with the new version, push it to Docker Hub and update the latest tag -- [semantic-release-vsce](https://github.com/raix/semantic-release-vsce) - - `verifyConditions`: Verify the presence and the validity of the "VS Code extension" authentication and release configuration - - `prepare`: Create a `.vsix` for distribution - - `publish`: Publish the package to the Visual Studio Code marketplace -- [semantic-release-verify-deps](https://github.com/piercus/semantic-release-verify-deps) - - `verifyConditions`: Check the dependencies format against a regexp before a release -- [semantic-release-openapi](https://github.com/aensley/semantic-release-openapi) - - `verifyConditions`: Verify `apiSpecFiles` is specified with at least one file name and all matching files have a .json, .yaml, or .yml extension. - - `prepare`: Write the correct version to all OpenAPI / Swagger files specified in `apiSpecFiles`. -- [semantic-release-chrome](https://github.com/GabrielDuarteM/semantic-release-chrome) - - `verifyConditions`: Verify the presence of the authentication (set via environment variables) - - `prepare`: Write the correct version to the `manifest.json` and creates a zip file of the whole dist folder - - `publish`: Uploads the generated zip file to the webstore, and publish the item -- [semantic-release-firefox-add-on](https://github.com/tophat/semantic-release-firefox-add-on) - - `verifyConditions`: Verify that all required options are present and authentication is set via environment variables - - `prepare`: Write the correct version to the `manifest.json` - - `publish`: Creates an unsigned `.xpi` file, and submits it to the Mozilla Add On store for signing. Once the package is signed, downloads the signed `.xpi` to a local directory -- [semantic-release-gerrit](https://github.com/pascalMN/semantic-release-gerrit) - - `generateNotes`: Generate release notes with Gerrit reviews URL -- [semantic-release-expo](https://github.com/bycedric/semantic-release-expo) - - `verifyConditions`: Verify Expo manifest(s) are readable and valid. - - `prepare`: Update version, ios build number and android version code in the Expo manifest(s). -- [maven-semantic-release](https://github.com/conveyal/maven-semantic-release) - - `verifyConditions`: Verifies that the `pom.xml` file and other files exist and are setup to allow releases - - `verifyRelease`: Checks and warns (does not error by default) if the version numbers found on maven central and within the Git project differ by quite a bit - - `prepare`: Changes the version number in the `pom.xml` (or all `pom.xml` files in maven projects with multiple `pom.xml` files) and optionally creates a commit with this version number and pushes it to `master` - - `publish`: Runs `mvn deploy` to deploy to maven central and optionally will update to next snapshot version and merge changes to development branch -- [maven-semantic-release](https://github.com/terrestris/maven-semantic-release) (alternative version) - - `verifyConditions`: Verifies that the `mvn` command exists. - - `prepare`: Changes version number in `pom.xml` and optionally in all child modules. - - `publish`: Runs one of the mvn targets `deploy`, `package jib:build` or `deploy jib:build`. - - `success`: Optionally sets new snapshot version and commits it. -- [semantic-release-ado](https://github.com/lluchmk/semantic-release-ado) - - `prepare`: Stores the version number as an Azure DevOps pipeline variable available to downstream steps on the job -- [gradle-semantic-release](https://github.com/KengoTODA/gradle-semantic-release-plugin) - - `verifyConditions`: Verify that project has a Gradle wrapper script, and `build.gradle` contains a task to publish artifacts. - - `prepare`: Changes the version number in the `gradle.properties` - - `publish`: Triggers Gradle to publish artifacts. -- [semantic-release-circleci-orb](https://github.com/matt-oakes/semantic-release-circleci-orb) - - `verifyConditions`: Verify the presence of the `CIRCLECI_API_TOKEN` environment variable, `orbName` option, and the `circleci` CLI. - - `publish`: Publish the CircleCI orb. -- [semantic-release-github-pages](https://github.com/qiwi/semantic-release-gh-pages-plugin) - - `verifyConditions`: Verify the presence of the auth token set via environment variables. - - `publish`: Pushes commit to the documentation branch. -- [semantic-release-github-pullrequest](https://github.com/asbiin/semantic-release-github-pullrequest) - - `verifyConditions`: Verify the presence and the validity of the GitHub authentication and other configuration. - - `publish`: Create a branch to upload all assets and create the pull request on the base branch on GitHub. -- [leiningen-semantic-release](https://github.com/NoxHarmonium/leiningen-semantic-release) - - `verifyConditions`: Checks the project.clj is syntactically valid. - - `prepare`: Update the project.clj version and package the output jar file. - - `publish`: Publish the jar (and generated Maven metadata) to a maven repository (or clojars). -- [@saithodev/semantic-release-gitea](https://github.com/saitho/semantic-release-gitea) - - `verifyConditions`: Verify the presence and the validity of the authentication and the assets option configuration. - - `publish`: Publish a Gitea release, optionally uploading file assets. - - `addChannel`: Update a Gitea release's pre-release field. -- [semantic-release-replace-plugin](https://github.com/jpoehnelt/semantic-release-replace-plugin) - - `prepare`: Replace version strings in files using regex and glob. -- [semantic-release-rubygem](https://github.com/Gusto/semantic-release-rubygem) - - `verifyConditions`: Locate and validate a `.gemspec` file, locate and validate a `lib/**/version.rb` file, verify the presence of the `GEM_HOST_API_KEY` environment variable, and create a credentials file with the API key. - - `prepare`: Update the version in the `lib/**/version.rb` version file and [build](https://guides.rubygems.org/command-reference/#gem-build) the gem. - - `publish`: [Push the Ruby gem](https://guides.rubygems.org/command-reference/#gem-push) to the gem server. -- [semantic-release-npm-deprecate-old-versions](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions) - - `verifyConditions`: Validates configuration. - - `publish`: Deprecates old versions, based on the declaration of supported versions in the config. -- [amanda-mitchell/semantic-release-npm-multiple](https://github.com/amanda-mitchell/semantic-release-npm-multiple) - - **Note**: this is a thin wrapper around the built-in npm plugin that can target multiple registries - - `verifyConditions`: Verify the presence and the validity of the npm authentication and release configuration for multiple registries - - `prepare`: Update the package.json version and create the npm package tarball - - `publish`: Publish the package on the npm registry for multiple registries -- [semantic-release-license](https://github.com/cbhq/semantic-release-license) Automatically update dates and more in your license file for new releases. - - `verifyConditions`: Verify the presence of a license file - - `prepare`: Update the license file based on its type -- [semantic-release-pypi](https://github.com/abichinger/semantic-release-pypi) - - `verifyConditions`: Verify the environment variable `PYPI_TOKEN` and installation of build tools - - `prepare`: Update the version in `setup.cfg` and create the distribution packages - - `publish`: Publish the python package to a repository (default: pypi) -- [@covage/semantic-release-poetry-plugin](https://github.com/covage/semantic-release-poetry-plugin) - - `verifyConditions`: Verify the presence and validity of `pyproject.toml` file. - - `prepare`: Update the version in `pyproject.toml`. -- [semantic-release-codeartifact](https://github.com/ryansonshine/semantic-release-codeartifact) - - `verifyConditions`: Validate configuration, get AWS CodeArtifact authentication and repository, validate `publishConfig` or `.npmrc` (if they exist), then pass the configuration to the associated plugins. -- [semantic-release-telegram](https://github.com/pustovitDmytro/semantic-release-telegram) - - `verifyConditions`: Validate configuration and verify `TELEGRAM_BOT_ID` and `TELEGRAM_BOT_TOKEN` - - `success`: Publish a message about the successful release to a telegram chat - - `fail`: publish a message about failure to a telegram chat -- [semantic-release-heroku](https://github.com/pustovitDmytro/semantic-release-heroku) - - `verifyConditions`: Validate configuration and verify `HEROKU_API_KEY` - - `prepare`: Update the package.json version and create release tarball - - `publish`: Publish version to heroku -- [semantic-release-mattermost](https://github.com/ttrobisch/semantic-release-mattermost) - - `verifyConditions`: Verify that the webhook is setup and release-notes-generator is present. - - `success`: Send a message about the new release and its notes to a [mattermost](https://mattermost.com/) webhook. -- [semantic-release-github-milestones](https://github.com/nitzano/semantic-release-github-milestones) - - `verifyConditions`: Verify github tokens are present and valid. - - `verifyRelease`: Display information regarding the matching github milestone. -- [semantic-release-telegram-bot](https://github.com/skoropadas/semantic-release-telegram-bot) - - `verifyConditions`: Validate configuration and verify `TELEGRAM_BOT_TOKEN` and package name - - `success`: Publish a success message to certain telegram chats - - `fail`: Publish a fail message to certain telegram chats -- [semantic-release-npm-deprecate](https://github.com/jpoehnelt/semantic-release-npm-deprecate) - - `publish`: Automatically mark old versions as deprecated. -- [semantic-release-mirror-version](https://github.com/GarthDB/semantic-release-mirror-version) - - `prepare`: Update the version number in any file that matches the defined [file glob](https://github.com/isaacs/node-glob). -- [semantic-release-space](https://github.com/123FLO321/semantic-release-space) - - `verifyConditions` Verifies that all required options are set. - - `prepare` Creates a JetBrains Space Deployment Target if it does not yet exist. - - `publish` Starts a JetBrains Space Deployment. - - `success` Marks the JetBrains Space Deployment as completed. - - `fail` Marks the JetBrains Space Deployment as failed. -- [semantic-release-react-native](https://github.com/alexandermendes/semantic-release-react-native) - - `verifyConditions` Validate configuration. - - `prepare` Version native iOS and Android files. -- [semantic-release-cargo](https://github.com/buehler/semantic-release-cargo) - - `verifyConditions` Validate configuration, `Cargo.toml`, and local cargo executable. Also, logs in into `crates.io`. - - `prepare` Write the new version number into `Cargo.toml` file and perform `cargo check` if configured. - - `publish` Publish the Rust crate to `crates.io` -- [semantic-release-coralogix](https://github.com/adobe/semantic-release-coralogix) - - `verifyConditions` Verified that required credentials are provided and API is accessible - - `publish` add a release tag to Coralogix -- [semantic-release-jira-notes](https://github.com/iamludal/semantic-release-jira-notes) - - `verifyConditions`: Validate the config options. - - `generateNotes`: Generate the release notes with links to JIRA issues. -- [semantic-release-major-tag](https://github.com/doteric/semantic-release-major-tag) - - `success` Create major version tag, for example `v1`. -- [semantic-release-yarn](https://github.com/hongaar/semantic-release-yarn) - - **Note**: this is an alternative to the default `@semantic-release/npm` plugin and adds support for monorepos. - - `verifyConditions` Verify Yarn 2 or higher is installed, verify the presence of a NPM auth token (either in an environment variable or a `.yarnrc.yml` file) and verify the authentication method is valid. - - `prepare` Update the `package.json` version and create the package tarball. - - `addChannel` Add a tag for the release. - - `publish` Publish to the npm registry. -- [semantic-release-pub](https://github.com/zeshuaro/semantic-release-pub) - - `verifyConditions`: Verify the presence of the `pub.dev` authentication and release configuration - - `prepare`: Update the `pubspec.yaml` version - - `publish`: Publish the package onto the `pub.dev` registry -- [semantic-release-hackage](https://github.com/stackbuilders/semantic-release-hackage) - - `verifyConditions`: Verify the environment variable `HACKAGE_TOKEN` - - `prepare`: Update the version of .cabal file and create the distribution package (.tar) - - `publish`: Publish the release candidate to the specified repository in Hackage -- [semantic-release-pull-request-analyzer](https://github.com/bobvanderlinden/semantic-release-pull-request-analyzer) - - `verifyConditions` Verify configuration options and existance of GitHub token. - - `analyzeCommits` Determine the type of release by analyzing merged GitHub pull requests and their labels. - - `generateNotes` Generates release notes using [GitHub release notes generator](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes). -- [semantic-release-commits-lint](https://github.com/BondarenkoAlex/semantic-release-commits-lint) - - `analyzeCommits` Analyzing commit messages by [commitlint](https://github.com/conventional-changelog/commitlint). -- [semantic-release-kaniko](https://github.com/brendangeck/semantic-release-kaniko) - - `verifyConditions`: Verify that all needed configuration is present and login to the Docker registry. - - `publish`: Build a container image using [Kaniko](https://github.com/GoogleContainerTools/kaniko) and (optionally) push it to a Docker registry. -- [semantic-release-skopeo](https://github.com/LukasWestholt/semantic-release-skopeo) - - `verifyConditions`: Verify that all needed configuration is present and check if destination is writeable (unless force=true). - - `publish`: Copy OCI images to a custom (Docker) registry using daemonless open-source tool [skopeo](https://github.com/containers/skopeo/). -- [sr-uv-plugin](https://github.com/Artessan-Devs/sr-uv-plugin) - - `verifyConditions`: Ensures `pyproject.toml` exists and contains a `[project]` section. - - `prepare`: Updates the `[project].version` field in `pyproject.toml` to match the release version. -- [semantic-release-uv](https://github.com/Deltamir/semantic-release-uv) - - `verifyConditions`: Verify the presence and validity of a `PYPI_TOKEN` and validate the `pyproject.toml` structure - - `prepare`: Update the version in `pyproject.toml`, locking and build the distribution with `uv` - - `publish`: Publish the package to PyPI or a custom index using `uv publish` -- [@jno21/semantic-release-github-commit](https://github.com/Jno21/semantic-release-github-commit) - - **Notes**: This plugin creates a commit on GitHub using the GitHub API, enabling signed commits via a GitHub App. - - `verifyConditions`: Verify GitHub authentication and configuration. - - `prepare`: Create a commit with the specified files using the GitHub API. -- [semantic-release-minecraft](https://github.com/pynickle/semantic-release) - - `verifyConditions`: Verify that all needed configuration is present. - - `prepare`: Convert different types of CurseForge game versions to their corresponding IDs. - - `publish`: Publish the Minecraft project to CurseForge and Modrinth. diff --git a/src/content/docs/extending/plugins-list.mdx b/src/content/docs/extending/plugins-list.mdx new file mode 100644 index 0000000..b8367cd --- /dev/null +++ b/src/content/docs/extending/plugins-list.mdx @@ -0,0 +1,703 @@ +--- +title: "Plugins" +description: "Extend semantic-release with official and community plugins for publishing, notifications, and more." +--- + +import PluginCard from "~/components/PluginCard.astro"; + +Extend semantic-release with official and community plugins for publishing, notifications, and more. + +## Official plugins + +
+ +conventional-changelog.', + }} +/> + +conventional-changelog.', + }} +/> + +GitHub release.', + success: + "Add a comment to GitHub issues and pull requests resolved in the release.", + fail: "Open a GitHub issue when a release fails.", + }} +/> + + + +GitLab release.', + }} +/> + + + + + + + +ATOM_ACCESS_TOKEN environment variable and the apm CLI.', + prepare: + 'Update the package.json version with npm version.', + publish: + 'Publish the Atom package.', + }} +/> + +
+ +## Community plugins + +:::note[Add your own!] +Have you built a plugin for semantic-release? +Open a PR adding a new plugin to this page! +::: + +
+ +SLACK_WEBHOOK has been defined.", + success: "Publish a message about the success to a slack channel.", + fail: "Optionally publish a message about failure to a slack channel.", + }} +/> + +name with the new version, push it to Docker Hub and update the latest tag.", + }} +/> + +name with the new version and channel and push it to the configured docker registry.", + addChannel: + "Updates a release published on one channel with the destinations channel tag and pushes to the registry i.e.: next to latest.", + }} +/> + +name with the new version, push it to Docker Hub and update the latest tag.", + }} +/> + +.vsix for distribution.", + publish: "Publish the package to the Visual Studio Code marketplace.", + }} +/> + + + +apiSpecFiles is specified with at least one file name and all matching files have a .json, .yaml, or .yml extension.", + prepare: + "Write the correct version to all OpenAPI / Swagger files specified in apiSpecFiles.", + }} +/> + +manifest.json and creates a zip file of the whole dist folder.", + publish: + "Uploads the generated zip file to the webstore, and publish the item.", + }} +/> + +manifest.json.", + publish: + "Creates an unsigned .xpi file, and submits it to the Mozilla Add On store for signing. Once the package is signed, downloads the signed .xpi to a local directory.", + }} +/> + + + + + +pom.xml file and other files exist and are setup to allow releases.", + verifyRelease: + "Checks and warns (does not error by default) if the version numbers found on maven central and within the Git project differ by quite a bit.", + prepare: + "Changes the version number in the pom.xml (or all pom.xml files in maven projects with multiple pom.xml files) and optionally creates a commit with this version number and pushes it to master.", + publish: + "Runs mvn deploy to deploy to maven central and optionally will update to next snapshot version and merge changes to development branch.", + }} +/> + +mvn command exists.", + prepare: + "Changes version number in pom.xml and optionally in all child modules.", + publish: + "Runs one of the mvn targets deploy, package jib:build or deploy jib:build.", + success: "Optionally sets new snapshot version and commits it.", + }} +/> + + + +build.gradle contains a task to publish artifacts.", + prepare: + "Changes the version number in the gradle.properties.", + publish: "Triggers Gradle to publish artifacts.", + }} +/> + +CIRCLECI_API_TOKEN environment variable, orbName option, and the circleci CLI.", + publish: "Publish the CircleCI orb.", + }} +/> + + + + + + + + + + + +.gemspec file, locate and validate a lib/**/version.rb file, verify the presence of the GEM_HOST_API_KEY environment variable, and create a credentials file with the API key.", + prepare: + 'Update the version in the lib/**/version.rb version file and build the gem.', + publish: + 'Push the Ruby gem to the gem server.', + }} +/> + + + + + + + +PYPI_TOKEN and installation of build tools.", + prepare: + "Update the version in setup.cfg and create the distribution packages.", + publish: "Publish the python package to a repository (default: pypi).", + }} +/> + +pyproject.toml file.", + prepare: "Update the version in pyproject.toml.", + }} +/> + +publishConfig or .npmrc (if they exist), then pass the configuration to the associated plugins.", + }} +/> + +TELEGRAM_BOT_ID and TELEGRAM_BOT_TOKEN.", + success: + "Publish a message about the successful release to a telegram chat.", + fail: "Publish a message about failure to a telegram chat.", + }} +/> + +HEROKU_API_KEY.", + prepare: "Update the package.json version and create release tarball.", + publish: "Publish version to heroku.", + }} +/> + +mattermost webhook.', + }} +/> + + + +TELEGRAM_BOT_TOKEN and package name.", + success: "Publish a success message to certain telegram chats.", + fail: "Publish a fail message to certain telegram chats.", + }} +/> + + + +file glob.', + }} +/> + + + + + +Cargo.toml, and local cargo executable. Also, logs in into crates.io.", + prepare: + "Write the new version number into Cargo.toml file and perform cargo check if configured.", + publish: "Publish the Rust crate to crates.io.", + }} +/> + + + + + +v1.", + }} +/> + +.yarnrc.yml file) and verify the authentication method is valid.", + prepare: + "Update the package.json version and create the package tarball.", + addChannel: "Add a tag for the release.", + publish: "Publish to the npm registry.", + }} +/> + +pub.dev authentication and release configuration.", + prepare: "Update the pubspec.yaml version.", + publish: "Publish the package onto the pub.dev registry.", + }} +/> + +HACKAGE_TOKEN.", + prepare: + "Update the version of .cabal file and create the distribution package (.tar).", + publish: + "Publish the release candidate to the specified repository in Hackage.", + }} +/> + +GitHub release notes generator.', + }} +/> + +commitlint.', + }} +/> + +Kaniko and (optionally) push it to a Docker registry.', + }} +/> + +skopeo.', + }} +/> + +pyproject.toml exists and contains a [project] section.", + prepare: + "Updates the [project].version field in pyproject.toml to match the release version.", + }} +/> + +PYPI_TOKEN and validate the pyproject.toml structure.", + prepare: + "Update the version in pyproject.toml, locking and build the distribution with uv.", + publish: + "Publish the package to PyPI or a custom index using uv publish.", + }} +/> + + + + + +
diff --git a/src/content/docs/foundation/considerations.md b/src/content/docs/foundation/considerations.md new file mode 100644 index 0000000..77f9745 --- /dev/null +++ b/src/content/docs/foundation/considerations.md @@ -0,0 +1,54 @@ +--- +title: Considerations +--- + +**semantic-release** is + +- an opinionated release tool +- a tool to simplify versioning releases semantically first, automating steps related to a release process second +- a tool that encourages engineering practices that support delivering high quality at a sustainable pace (continuous deployment/release, trunk-based development) + +## What is your primary goal? + +If your primary attraction is for automatic release note generation rather than semantic versioning, you may want to reconsider if **semantic-release** is the right fit for your goals. + +:::tip[Recommendation] +Adopt **semantic-release** when semantic versioning is your primary objective, with release-step automation as a secondary benefit. +::: + +## Do you actually need semantic versioning? + +The use of the word "semantic" in the term "semantic versioning" has the intent that the structure of the version conveys specific meaning. +Consult https://semver.org/ for details of that meaning, but keep in mind that the semantics are from the perspective of a consumer. + +Semantic versioning is most useful for software releases that are consumed programmatically. +Common examples are libraries/packages consumed as dependencies. +Base Docker images can also fall in this category because they are consumed in a way that other layers build on top of them. + +Applications that are deployed directly to a runtime environment lack an audience to benefit from semantic versioning. +Docker images that are published to a registry only for the purpose of deploying directly to a runtime environment fall into this category, even though they are a published asset. +Often, using the git SHA as the version for such assets is a better choice than versioning them semantically. + +:::tip[Recommendation] +Prioritize semantic versioning for artifacts consumed as dependencies; for directly deployed artifacts, consider using git SHAs instead. +::: + +## Can you simplify the release steps automated by **semantic-release**? + +Updating the version in the `package.json` of an npm package or providing release notes in a `CHANGELOG.md` file are popular release steps +that can be enabled with **semantic-release** using the [changelog](https://github.com/semantic-release/changelog) and [git](https://github.com/semantic-release/git) plugins. +However, those two plugins are intentionally _not_ included in the default configuration of **semantic-release** because +[they are not necessary for **semantic-release** to function](/support/faq#it-is-not-needed-for-semantic-release-to-do-its-job) +and [making commits during the release process adds significant complexity](/support/faq#making-commits-during-the-release-process-adds-significant-complexity). + +Please consider the trade-offs of adding those plugins to your release configuration for potentially unnecessary goals. + +:::tip[Recommendation] +Keep your configuration minimal and only add release-time commits when there is a clear, justified need. +::: + +## Is the branching strategy of your project supported by **semantic-release**? + +Before adopting **semantic-release**, confirm that your team's branching model is compatible. + +See [supported branching strategies](/foundation/supported-branching) diff --git a/src/content/docs/foundation/how-it-works.md b/src/content/docs/foundation/how-it-works.md new file mode 100644 index 0000000..a4054a3 --- /dev/null +++ b/src/content/docs/foundation/how-it-works.md @@ -0,0 +1,61 @@ +--- +title: How it Works +--- + +**semantic-release** automates package release workflows by turning commit history into predictable versioning and publishing decisions. + +At a high level, it answers three questions on every run: + +1. Should a release happen? +2. If yes, what version should be released? +3. Where and how should that release be published? + +## The core model + +When `semantic-release` runs in CI on a configured release branch, it compares commits since the last Git tag and determines release impact from commit semantics. + +This relies on a formalized commit message convention. By default, **semantic-release** uses the [Angular Commit Message Conventions](https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md), where the type prefix in each commit message signals the impact of that change: + +- `fix` commits produce patch releases +- `feat` commits produce minor releases +- `BREAKING CHANGE` in a commit footer produces major releases + +If no commits since the last release carry a recognized type, no release is published. + +Tools like [commitizen](https://github.com/commitizen/cz-cli) and [commitlint](https://github.com/conventional-changelog/commitlint) can help contributors author valid commit messages consistently. + +For deeper details on commit analysis, release steps, and plugin hooks, see [Release Steps](/foundation/release-steps/) and [Plugins](/foundation/plugins/). + +## Why CI is central + +The release command is designed to run in CI after successful builds. This keeps releases deterministic and removes manual, error-prone release actions. + +Each push or merge to a release branch can trigger a release run. Whether that run publishes depends on commit analysis, branch configuration, and plugin behavior. + +For setup guidance, see [CI Configuration](/usage/ci-configuration/) and [Getting Started](/usage/getting-started/). + +## What drives release behavior + +Release behavior is determined by a small set of inputs: + +- Commit history since the last release tag +- Branch configuration (release, maintenance, pre-release) +- Plugin pipeline and plugin options +- Credentials available in the CI environment + +Those inputs produce outputs such as: + +- The next semantic version +- Release notes +- Git tags +- Published artifacts or channels (for example npm dist-tags) + +See [Release Workflow Configuration](/foundation/workflow-configuration/) and [Supported Branching Models](/foundation/supported-branching/) for branching behavior. + +## Safety and constraints + +**semantic-release** is intentionally opinionated. It prioritizes consistent semantic versioning and continuous delivery/release workflows over manual or ad hoc processes. + +That means it may refuse to publish when conditions are invalid, such as version conflicts across branches, missing release branches, or failed verification steps. + +Read [Considerations](/foundation/considerations/) before designing a workflow that diverges from these assumptions. diff --git a/src/content/docs/foundation/index.mdx b/src/content/docs/foundation/index.mdx new file mode 100644 index 0000000..456d7a5 --- /dev/null +++ b/src/content/docs/foundation/index.mdx @@ -0,0 +1,51 @@ +--- +title: Foundations +--- + +import { CardGrid, LinkCard } from "@astrojs/starlight/components"; + +Learn the concepts, constraints, and mental models that make **semantic-release** work. + + + + + + + + + + + + + + + + diff --git a/src/content/docs/foundation/plugins.md b/src/content/docs/foundation/plugins.md new file mode 100644 index 0000000..efeb0c1 --- /dev/null +++ b/src/content/docs/foundation/plugins.md @@ -0,0 +1,127 @@ +--- +title: "Plugins" +--- + +Plugins let `semantic-release` extend release steps through configurable lifecycle methods. Core owns the release lifecycle, exposes lifecycle hooks for selected release steps, and invokes plugin methods bound to those hooks. + +This enables support for different [commit message conventions](/foundation/how-it-works/#the-core-model), release note generators, and publishing platforms. + +A plugin is a npm module that can implement one or more lifecycle methods for the following hooks: + +| Lifecycle Hook | Related Release Step | Required | Description | +| ------------------ | ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `verifyConditions` | Verify Conditions | No | Verify conditions necessary to proceed with the release: configuration is correct, authentication tokens are valid, and so on. | +| `analyzeCommits` | Analyze Commits | Yes | Determine the type of the next release (`major`, `minor`, or `patch`). This hook is required to decide the next release type. If multiple plugins implement `analyzeCommits`, the highest release type returned wins. | +| `verifyRelease` | Verify Release | No | Verify the parameters of the release that is about to be published, such as version, type, or distribution tag. | +| `generateNotes` | Generate Notes | No | Generate the content of the release note. If multiple plugins implement `generateNotes`, the release notes will be the concatenation of each plugin output. | +| `prepare` | Prepare | No | Prepare the release, for example by creating or updating files such as `package.json`, `CHANGELOG.md`, documentation, or compiled assets and pushing a commit. | +| `publish` | Publish | No | Publish the release. | +| `addChannel` | Add Channel (optional) | No | Assign the release to a distribution channel when channel management is needed, for example by adding an npm dist-tag. | +| `success` | Notify | No | Notify consumers or maintainers after a successful release. | +| `fail` | Notify | No | Notify consumers or maintainers after a failed release. | + +For each [release step](/foundation/release-steps/), **semantic-release** runs every plugin in the [`plugins` array](#plugins-declaration-and-execution-order) that implements the hook for that step. + +Not every release step is hook-backed. For example, core handles `Get Last Release` and `Create Git Tag` directly. `addChannel` is a special-case hook used only when channel management applies. + +:::note +If no plugin with an `analyzeCommits` method is defined `@semantic-release/commit-analyzer` will be used. +::: + +## Plugins installation + +### Default plugins + +These four plugins are already part of **semantic-release** and are listed in order of execution. They should not be installed separately; installing them independently can result in conflicting behavior if multiple versions are present: + +``` +"@semantic-release/commit-analyzer" +"@semantic-release/release-notes-generator" +"@semantic-release/npm" +"@semantic-release/github" +``` + +### Additional plugins + +Additional plugins should be provided to `npx` with `--package` when running `semantic-release`: + +```bash +$ npx \ + --package semantic-release \ + --package @semantic-release/git \ + --package @semantic-release/changelog \ + semantic-release +``` + +See the [official and community plugins list](/extending/plugins-list) for packages that extend **semantic-release** beyond the default set. + +If you want to build your own plugin, see [Plugin development](/developer-guide/plugin/). + +## Plugins declaration and execution order + +If you need to customize the default plugin set or execution order, configure the [`plugins` option](/usage/configuration/#plugins) by listing plugins by npm module name. + +```json +{ + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/npm" + ] +} +``` + +:::note +If the `plugins` option is defined, it overrides the default plugin list, rather than merging with it. +::: + +For each [release step](/foundation/release-steps/), the plugins that implement that step's lifecycle hook will be executed in the order in which they are defined. + +```json +{ + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/npm", + "@semantic-release/git" + ] +} +``` + +With this configuration **semantic-release** will: + +- execute the `verifyConditions` implementation of `@semantic-release/npm` then `@semantic-release/git` +- execute the `analyzeCommits` implementation of `@semantic-release/commit-analyzer` +- execute the `generateNotes` implementation of `@semantic-release/release-notes-generator` +- execute the `prepare` implementation of `@semantic-release/npm` then `@semantic-release/git` +- execute the `publish` implementation of `@semantic-release/npm` + +Order is first determined by release steps (such as `Verify Conditions` → `Analyze Commits`). At each release step, plugins are executed in the order in which they are defined. + +## Plugin options configuration + +A plugin configuration can be specified by wrapping the name and an options object in an array. Options configured this way will be passed only to that specific plugin. + +Global plugin configuration can be defined at the root of the **semantic-release** configuration object. Options configured this way will be passed to all plugins. + +```json +{ + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/github", + { + "assets": ["dist/**"] + } + ], + "@semantic-release/git" + ], + "preset": "angular" +} +``` + +With this configuration: + +- All plugins will receive the `preset` option, which will be used by both `@semantic-release/commit-analyzer` and `@semantic-release/release-notes-generator` (and ignored by `@semantic-release/github` and `@semantic-release/git`) +- The `@semantic-release/github` plugin will receive the `assets` option (`@semantic-release/git` will not receive it and therefore will use its default value for that option) diff --git a/src/content/docs/foundation/release-steps.md b/src/content/docs/foundation/release-steps.md new file mode 100644 index 0000000..2c93edf --- /dev/null +++ b/src/content/docs/foundation/release-steps.md @@ -0,0 +1,83 @@ +--- +title: Release Steps +--- + +This page explains the release steps that make up a `semantic-release` run. + +- A **release lifecycle** is the full recurring process that starts from the previous release state and ends with the next release state. +- **Release steps** are the individual phases within one run of that lifecycle. +- Some release steps expose **lifecycle hooks** that plugins can bind to. +- Plugins participate by exposing **lifecycle methods** such as `analyzeCommits` or `publish`. + +If you are new to the overall model, read [How it Works](/foundation/how-it-works/) first. + +## Step sequence + +After tests pass and `semantic-release` starts, it evaluates the repository state and executes release steps in a fixed order. + +| Release Step | Lifecycle Hook(s) | Purpose | +| ---------------------- | ------------------ | --------------------------------------------------------------- | +| Verify Conditions | `verifyConditions` | Confirm required configuration and credentials are available. | +| Get Last Release | None | Find the most recent release by reading Git tags and history. | +| Analyze Commits | `analyzeCommits` | Determine whether to release and which version type to produce. | +| Verify Release | `verifyRelease` | Validate the computed release metadata before publishing. | +| Generate Notes | `generateNotes` | Build release notes for the commits included in this release. | +| Create Git Tag | None | Tag the release version in Git. | +| Add Channel (Optional) | `addChannel` | Associate the release with a distribution channel when needed. | +| Prepare | `prepare` | Perform pre-publish updates such as assets or files. | +| Publish | `publish` | Publish artifacts to configured destinations and channels. | +| Notify | `success`, `fail` | Report success or failure through provider integrations. | + +The order is important. A failure in an early step prevents later steps from running. + +## Optional and conditional steps + +Not every release step in the table above runs on every release. + +- Some release steps are core-only and do not expose lifecycle hooks. `Get Last Release` is the clearest example. +- Some steps expose more than one lifecycle hook. `Notify` is implemented through the `success` and `fail` hooks. +- Some release steps are conditional. The `Add Channel` release step is an example; it runs only when channel management behavior is needed. + +## How steps are implemented + +Release steps are executed by a combination of core behavior and plugins. + +- Core handles some behavior directly, including steps that are not exposed as hooks +- `analyzeCommits` is required to decide version impact +- Most hook-backed steps depend on which plugins you configure +- If multiple plugins implement the same lifecycle hook, they execute in plugin order + +For plugin responsibilities and execution details, see [Plugins](/foundation/plugins/). + +## Release decision logic + +The `analyzeCommits` step is the decision point for whether a release is created. + +The examples below assume the default Conventional Commits mapping and that the highest-impact commit type since the last release determines the version bump + +- No relevant commits since the last release means no new release +- `fix` commits result in a patch release +- `feat` commits result in a minor release +- `BREAKING CHANGE` results in a major release + +Commit parsing depends on your configured commit analyzer and presets. See [How it Works](/foundation/how-it-works/) for the conceptual model and [Configuration](/usage/configuration/) for setup details. + +## Branch and channel impact + +The same steps run regardless of branch type, but release outcomes vary with branch strategy and channel configuration. + +- Release branches publish regular versions +- Maintenance branches publish within defined ranges +- Pre-release branches publish pre-release identifiers + +See [Supported Branching Models](/foundation/supported-branching/) and [Release Workflow Configuration](/foundation/workflow-configuration/) for branch behavior and constraints. + +## Operational expectations + +To keep releases deterministic, run `semantic-release` only in CI and only after all required checks pass. + +For implementation guidance, see: + +- [Getting Started](/usage/getting-started/) +- [CI Configuration](/usage/ci-configuration/) +- [Running semantic-release](/usage/running/) diff --git a/src/content/docs/foundation/shareable-configurations.md b/src/content/docs/foundation/shareable-configurations.md new file mode 100644 index 0000000..e876ebf --- /dev/null +++ b/src/content/docs/foundation/shareable-configurations.md @@ -0,0 +1,38 @@ +--- +title: "Shareable Configurations" +--- + +A shareable configuration is an [npm](https://www.npmjs.com/) package that exports a reusable **semantic-release** configuration object. It lets teams define a common release workflow once and apply it across several projects. + +## When to use it + +Use a shareable configuration when multiple repositories should follow the same release workflow and only need small project-specific overrides. + +In practice, a shareable configuration usually provides the base configuration, while each project keeps only the settings that differ locally. + +## How to use it + +The shareable configurations to use can be set with the [extends](/usage/configuration/#extends) option, using either an npm package name or a local file path. + +```json +{ + "extends": "@semantic-release/gitlab-config" +} +``` + +For example, a project can extend a shared base config and still override its own branches locally: + +```json +{ + "extends": "@semantic-release/gitlab-config", + "branches": ["main", "next"] +} +``` + +If multiple shareable configurations are defined, they are loaded in order. Local configuration and CLI arguments take precedence over values defined in a shareable configuration. + +## Shareable Configurations list + +See the [shareable configurations list](/extending/shareable-configurations-list) for official and community-maintained packages you can extend. + +If you want to build your own shareable configuration, see [Shareable configuration development](/developer-guide/shareable-configuration/). diff --git a/src/content/docs/foundation/supported-branching.md b/src/content/docs/foundation/supported-branching.md new file mode 100644 index 0000000..2dbe060 --- /dev/null +++ b/src/content/docs/foundation/supported-branching.md @@ -0,0 +1,92 @@ +--- +title: Supported Branching Models +--- + +This page summarizes branching models that align well with **semantic-release** and those that are officially unsupported. + +:::tip[Recommendation] +Default to workflows that keep changes flowing to a stable trunk quickly and continuously. +::: + +## Supported Branching Models + +These models align with the delivery and release assumptions built into **semantic-release**. + +### Trunk-Based Development + +- [Trunk-Based Development: Release from Trunk](https://trunkbaseddevelopment.com/release-from-trunk/) +- [MinimumCD: Trunk-Based Development](https://minimumcd.org/minimumcd/tbd/) + +#### Committing Straight to Trunk + +- [Trunk-Based Development for Smaller Teams](https://trunkbaseddevelopment.com/#trunk-based-development-for-smaller-teams) +- [Committing Straight to the Trunk](https://trunkbaseddevelopment.com/committing-straight-to-the-trunk/) + +#### Short-Lived Feature Branches + +- [Scaled Trunk-Based Development](https://trunkbaseddevelopment.com/#scaled-trunk-based-development) +- [Short-Lived Feature Branches](https://trunkbaseddevelopment.com/short-lived-feature-branches/) + +#### Continuous Integration + +- [MinimumCD: Continuous Integration](https://minimumcd.org/minimumcd/ci/) + +#### Continuous Deployment/Release + +- [Continuous Deployment](https://trunkbaseddevelopment.com/continuous-delivery/#continuous-deployment) + +:::tip[Recommendation] +Choose a trunk-based workflow that keeps branch lifetime short and integration frequent. +::: + +### GitHub Flow + +- [GitHub Docs: GitHub Flow](https://docs.github.com/en/get-started/using-github/github-flow) +- [GitHub Flow](https://githubflow.github.io/) + +:::tip[Recommendation] +GitHub Flow is a practical fit when pull requests are short-lived and releases are frequent. +::: + +## Officially Unsupported Branching Models + +These models conflict with the default expectations of **semantic-release** and are not supported by the project team. + +### Trunk-Based Development: Branch for Release + +- [Branch for Release](https://trunkbaseddevelopment.com/branch-for-release/) + +Exception: + +- [Late Creation of Release Branches](https://trunkbaseddevelopment.com/branch-for-release/#late-creation-of-release-branches) - _our maintenance release is an example of this approach_ + +### Git Flow: Long-Lived Branch Orchestration (develop/release/hotfix) + +- [A Successful Git Branching Model](https://nvie.com/posts/a-successful-git-branching-model/) +- [Why You Should Not Use Git Flow](https://jeffkreeftmeijer.com/git-flow/) + +Even if this is a strategy that you find useful for the applications you are building, [the original author of the git-flow branching model recommends against it](https://nvie.com/posts/a-successful-git-branching-model/) for that context, +we do not recommend this long-lived branch orchestration pattern when releasing artifacts with **semantic-release**. +While the [same reflection](https://nvie.com/posts/a-successful-git-branching-model/) that recommends against using git-flow for web apps suggests that it may still be a good fit for explicitly versioned software, +**semantic-release** is built with Continuous Deployment/Release in mind instead. + +While some have found that the [Pre-release workflow](/foundation/workflow-configuration/#prerelease) enabled by **semantic-release** can be used to _simulate_ a git-flow-like workflow, +it is also worth noting that this orchestration pattern is not an intended use case and requests for support when attempting to use it that way will be closed by our team. + +:::tip[Recommendation] +Avoid Git flow-style long-lived branch orchestration when using **semantic-release**. +::: + +### Workflows that Release for Testing Before Promotion to a Stable Release + +- [The Importance of a Local Build](https://trunkbaseddevelopment.com/styles/#the-importance-of-a-local-build) + +:::tip[Recommendation] +Prefer workflows where confidence comes from CI quality signals, with production release as the promotion event. +::: + +### Monorepos + +While monorepos are not specifically a branching strategy, they are also not an officially supported **semantic-release** setup at this time. +That said, the same branching and release principles described on this page still apply to releasable artifacts in a monorepo. +For teams that choose this approach, community plugins can enable monorepo support for now. diff --git a/src/content/docs/usage/workflow-configuration.md b/src/content/docs/foundation/workflow-configuration.md similarity index 55% rename from src/content/docs/usage/workflow-configuration.md rename to src/content/docs/foundation/workflow-configuration.md index cba34f6..260157e 100644 --- a/src/content/docs/usage/workflow-configuration.md +++ b/src/content/docs/foundation/workflow-configuration.md @@ -1,40 +1,44 @@ --- -title: "Release Workflow configuration" +title: "Release Workflow Configuration" --- -**semantic-release** enables managing and automating complex release workflow, based on multiple Git branches and distribution channels. This enables: +**semantic-release** enables managing and automating complex release workflows, based on multiple Git branches and distribution channels. This enables: - Distributing certain releases to a particular group of users via distribution channels -- Managing the availability of releases on distribution channels via branches merge +- Managing the availability of releases on distribution channels via branch merges - Maintaining multiple lines of releases in parallel - Working on large future releases outside the normal flow of one version increment per Git push See [Release workflow recipes](../recipes/release-workflow/#release-workflow) for detailed examples. -The release workflow is configured via the [branches option](configuration.md#branches) which accepts a single or an array of branch definitions. Each branch can be defined either as a string, a [glob](https://github.com/micromatch/micromatch#matching-features) or an object. For string and glob definitions each [property](workflow-configuration.md#branches-properties) will be defaulted. +The release workflow is configured via the [branches option](/usage/configuration/#branches), which accepts either a single branch definition or an array of branch definitions. Each branch can be defined as a string, a [glob](https://github.com/micromatch/micromatch#matching-features), or an object. For string and glob definitions, defaults are applied to each [property](#branch-properties). A branch can be defined as one of three types: -- [release](workflow-configuration.md#release-branches): to make releases on top of the last version released -- [maintenance](workflow-configuration.md#maintenance-branches): to make releases on top of an old release -- [pre-release](workflow-configuration.md#pre-release-branches): to make pre-releases +- [release](#release-branches): to make releases on top of the last version released +- [maintenance](#maintenance-branches): to make releases on top of an old release +- [pre-release](#pre-release-branches): to make pre-releases -The type of the branch is automatically determined based on naming convention and/or [properties](workflow-configuration.md#branches-properties). +The type of the branch is automatically determined based on naming conventions and/or [properties](#branch-properties). -## Branches properties +## Branch Properties -| Property | Branch type | Description | Default | -| ------------ | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `name` | All | **Required.** The Git branch holding the commits to analyze and the code to release. See [name](workflow-configuration.md#name). | - The value itself if defined as a `String` or the matching branches name if defined as a glob. | -| `channel` | All | The distribution channel on which to publish releases from this branch. Set to `false` to force the default distribution channel instead of using the default. See [channel](workflow-configuration.md#channel). | `undefined` for the first release branch, the value of `name` for subsequent ones. | -| `range` | [maintenance](workflow-configuration.md#maintenance-branches) only | **Required unless `name` is formatted like `N.N.x` or `N.x` (`N` is a number).** The range of [semantic versions](https://semver.org) to support on this branch. See [range](workflow-configuration.md#range). | The value of `name`. | -| `prerelease` | [pre-release](workflow-configuration.md#pre-release-branches) only | **Required.** The pre-release denotation to append to [semantic versions](https://semver.org) released from this branch. See [prerelease](workflow-configuration.md#prerelease). | - | +| Property | Branch type | Description | Default | +| ------------ | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `name` | All | **Required.** The Git branch holding the commits to analyze and the code to release. See [name](#name). | - The value itself if defined as a `String` or the matching branches name if defined as a glob. | +| `channel` | All | The distribution channel on which to publish releases from this branch. Set to `false` to force the default distribution channel instead of using the default. See [channel](#channel). | `undefined` for the first release branch, the value of `name` for subsequent ones. | +| `range` | [maintenance](#maintenance-branches) only | **Required unless `name` is formatted like `N.N.x` or `N.x` (`N` is a number).** The range of [semantic versions](https://semver.org) to support on this branch. See [range](#range). | The value of `name`. | +| `prerelease` | [pre-release](#pre-release-branches) only | **Required.** The pre-release denotation to append to [semantic versions](https://semver.org) released from this branch. See [prerelease](#prerelease). | - | -### name +### `name` + +**type**: `String`, `Glob`\ +**branch type**: All\ +**default**: The value itself if defined as a `String`, or the matching branch name if defined as a glob. A `name` is required for any type of branch. It can be defined as a [glob](https://github.com/micromatch/micromatch#matching-features) in which case the definition will be expanded to one per matching branch existing in the repository. -If `name` doesn't match to any branch existing in the repository, the definition will be ignored. For example the default configuration includes the definition `next` and `next-major` which will become active only when the branches `next` and/or `next-major` are created in the repository. This allow to define your workflow once with all potential branches you might use and have the effective configuration evolving as you create new branches. +If `name` doesn't match any branch that exists in the repository, the definition will be ignored. For example, the default configuration includes the definitions `next` and `next-major`, which become active only when the branches `next` and/or `next-major` are created in the repository. This allows you to define your workflow once with all potential branches you might use and have the effective configuration evolve as you create new branches. For example the configuration `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next']` will be expanded as: @@ -49,9 +53,13 @@ For example the configuration `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next']` } ``` -### channel +### `channel` + +**type**: `String`, `Boolean`\ +**branch type**: All\ +**default**: `undefined` for the first release branch; the value of `name` for subsequent ones. -The `channel` can be defined for any branch type. By default releases will be done on the default distribution channel (for example the `@latest` [dist-tag](https://docs.npmjs.com/cli/dist-tag) for npm) for the first [release branch](workflow-configuration.md#release-branches) and on a distribution channel named based on the branch `name` for any other branch. If the `channel` property is set to `false` the default channel will be used. +The `channel` can be defined for any branch type. By default releases will be done on the default distribution channel (for example the `@latest` [dist-tag](https://docs.npmjs.com/cli/dist-tag) for npm) for the first [release branch](#release-branches) and on a distribution channel named based on the branch `name` for any other branch. If the `channel` property is set to `false` the default channel will be used. The value of `channel`, if defined as a string, is generated with [Lodash template](https://lodash.com/docs#template) with the variable `name` available. @@ -66,9 +74,13 @@ For example the configuration `['master', {name: 'next', channel: 'channel-${nam } ``` -### range +### `range` -A `range` only applies to maintenance branches, is required and must be formatted like `N.N.x` or `N.x` (`N` is a number). In case the `name` is formatted as a range (for example `1.x` or `1.5.x`) the branch will be considered a maintenance branch and the `name` value will be used for the `range`. +**type**: `String`\ +**branch type**: [Maintenance](#maintenance-branches) only\ +**default**: The value of `name`. + +A `range` only applies to maintenance branches, is required (unless `name` is formatted like `N.N.x` or `N.x`), and must be formatted like `N.N.x` or `N.x` (`N` is a number). In case the `name` is formatted as a range (for example `1.x` or `1.5.x`) the branch will be considered a maintenance branch and the `name` value will be used for the `range`. For example the configuration `['1.1.x', '1.2.x', 'master']` will be expanded as: @@ -82,9 +94,13 @@ For example the configuration `['1.1.x', '1.2.x', 'master']` will be expanded as } ``` -### prerelease +### `prerelease` + +**type**: `String`, `Boolean`\ +**branch type**: [Pre-release](#pre-release-branches) only\ +**default**: - -A `prerelease` property applies only to pre-release branches and the `prerelease` value must be valid per the [Semantic Versioning Specification](https://semver.org/#spec-item-9). It will determine the name of versions (for example if `prerelease` is set to `beta` the version be formatted like `2.0.0-beta.1`, `2.0.0-beta.2` etc...). If the `prerelease` property is set to `true` the `name` value will be used. +A `prerelease` property applies only to pre-release branches and is required. The `prerelease` value must be valid per the [Semantic Versioning Specification](https://semver.org/#spec-item-9). It determines the format of versions (for example, if `prerelease` is set to `beta`, versions will be formatted like `2.0.0-beta.1`, `2.0.0-beta.2`, etc.). If the `prerelease` property is set to `true`, the `name` value will be used. The value of `prerelease`, if defined as a string, is generated with [Lodash template](https://lodash.com/docs#template) with the variable `name` available. @@ -106,22 +122,24 @@ For example the configuration `['master', {name: 'pre/rc', prerelease: '${name.r A release branch is the base type of branch used by **semantic-release** that allows to publish releases with a [semantic version](https://semver.org), optionally on a specific distribution channel. Distribution channels (for example [npm dist-tags](https://docs.npmjs.com/cli/dist-tag) or [Chrome release channels](https://www.chromium.org/getting-involved/dev-channel)) are a way to distribute new releases only to a subset of users in order to get early feedback. Later on, those releases can be added to the general distribution channel to be made available to all users. -**semantic-release** will automatically add releases to the corresponding distribution channel when code is [merged from a release branch to another](workflow-configuration.md#merging-into-a-release-branch). +**semantic-release** will automatically add releases to the corresponding distribution channel when code is [merged from a release branch to another](#merging-into-a-release-branch). -A project must define a minimum of 1 release branch and can have a maximum of 3. The order of the release branch definitions is significant, as versions released on a given branch must always be higher than the last release made on the previous branch. This allow to avoid situation that would lead to an attempt to publish releases with the same version number but different codebase. When multiple release branches are configured and a commit that would create a version conflict is pushed, **semantic-release** will not perform the release and will throw an `EINVALIDNEXTVERSION` error, listing the problematic commits and the valid branches on which to move them. +A project must define a minimum of 1 release branch and can have a maximum of 3. The order of the release branch definitions is significant, as versions released on a given branch must always be higher than the last release made on the previous branch. This allows avoiding situations that would lead to attempts to publish releases with the same version number but different codebases. When multiple release branches are configured and a commit that would create a version conflict is pushed, **semantic-release** will not perform the release and will throw an `EINVALIDNEXTVERSION` error, listing the problematic commits and the valid branches on which to move them. -**Note:** With **semantic-release** as with most package managers, a release version must be unique, independently of the distribution channel on which it is available. +:::note +With **semantic-release** as with most package managers, a release version must be unique, independently of the distribution channel on which it is available. +::: -See [publishing on distribution channels recipe](../recipes/release-workflow/distribution-channels.md) for a detailed example. +See [publishing on distribution channels recipe](/recipes/release-workflow/distribution-channels) for a detailed example. #### Pushing to a release branch With the configuration `"branches": ["master", "next"]`, if the last release published from `master` is `1.0.0` and the last one from `next` is `2.0.0` then: - Only versions in range `1.x.x` can be published from `master`, so only `fix` and `feat` commits can be pushed to `master` -- Once `next` get merged into `master` the release `2.0.0` will be made available on the channel associated with `master` and both `master` and `next` will accept any commit type +- Once `next` gets merged into `master`, the release `2.0.0` will be made available on the channel associated with `master`, and both `master` and `next` will accept any commit type -This verification prevent scenario such as: +This verification prevents scenarios such as: 1. Create a `feat` commit on `next` which triggers the release of version `1.0.0` on the `next` channel 2. Merge `next` into `master` which adds `1.0.0` on the default channel @@ -134,28 +152,28 @@ In step 4 **semantic-release** will throw an `EINVALIDNEXTVERSION` error to prev When merging commits associated with a release from one release branch to another, **semantic-release** will make the corresponding version available on the channel associated with the target branch. -When merging commits not associated with a release, commits from a [maintenance branch](workflow-configuration.md#maintenance-branches) or commits from a [pre-release branch](workflow-configuration.md#pre-release-branches) **semantic-release** will treat them as [pushed commits](workflow-configuration.md#pushing-to-a-release-branch) and publish a new release if necessary. +When merging commits not associated with a release, commits from a [maintenance branch](#maintenance-branches) or commits from a [pre-release branch](#pre-release-branches) **semantic-release** will treat them as [pushed commits](#pushing-to-a-release-branch) and publish a new release if necessary. ### Maintenance branches A maintenance branch is a type of branch used by **semantic-release** that allows to publish releases with a [semantic version](https://semver.org) on top of the codebase of an old release. This is useful when you need to provide fixes or features to users who cannot upgrade to the last version of your package. -A maintenance branch is characterized by a range which defines the versions that can be published from it. The [`range`](workflow-configuration.md#range) value of each maintenance branch must be unique across the project. +A maintenance branch is characterized by a range which defines the versions that can be published from it. The [`range`](#range) value of each maintenance branch must be unique across the project. **semantic-release** will always publish releases to a distribution channel specific to the range, so only the users who choose to use that particular line of versions will receive new releases. -Maintenance branches are always considered lower than [release branches](workflow-configuration.md#release-branches) and similarly to them, when a commit that would create a version conflict is pushed, **semantic-release** will not perform the release and will throw an `EINVALIDNEXTVERSION` error, listing the problematic commits and the valid branches on which to move them. +Maintenance branches are always considered lower than [release branches](#release-branches) and similarly to them, when a commit that would create a version conflict is pushed, **semantic-release** will not perform the release and will throw an `EINVALIDNEXTVERSION` error, listing the problematic commits and the valid branches on which to move them. -**semantic-release** will automatically add releases to the corresponding distribution channel when code is [merged from a release or maintenance branch to another maintenance branch](workflow-configuration.md#merging-into-a-maintenance-branch), however only versions within the branch `range` can be merged. If a merged version is outside the maintenance branch `range`, **semantic-release** will not add to the corresponding channel and will throw an `EINVALIDMAINTENANCEMERGE` error. +**semantic-release** will automatically add releases to the corresponding distribution channel when code is [merged from a release or maintenance branch to another maintenance branch](#merging-into-a-maintenance-branch), however only versions within the branch `range` can be merged. If a merged version is outside the maintenance branch `range`, **semantic-release** will not add to the corresponding channel and will throw an `EINVALIDMAINTENANCEMERGE` error. -See [publishing maintenance releases recipe](../recipes/release-workflow/maintenance-releases.md) for a detailed example. +See [publishing maintenance releases recipe](/recipes/release-workflow/maintenance-releases) for a detailed example. #### Pushing to a maintenance branch With the configuration `"branches": ["1.0.x", "1.x", "master"]`, if the last release published from `master` is `1.5.0` then: - Only versions in range `>=1.0.0 <1.1.0` can be published from `1.0.x`, so only `fix` commits can be pushed to `1.0.x` -- Only versions in range `>=1.1.0 <1.5.0` can be published from `1.x`, so only `fix` and `feat` commits can be pushed to `1.x` as long the resulting release is lower than `1.5.0` +- Only versions in range `>=1.1.0 <1.5.0` can be published from `1.x`, so only `fix` and `feat` commits can be pushed to `1.x` as long as the resulting release is lower than `1.5.0` - Once `2.0.0` is released from `master`, versions in range `>=1.1.0 <2.0.0` can be published from `1.x`, so any number of `fix` and `feat` commits can be pushed to `1.x` #### Merging into a maintenance branch @@ -169,15 +187,15 @@ With the configuration `"branches": ["1.0.x", "1.x", "master"]`, if the last rel ### Pre-release branches -A pre-release branch is a type of branch used by **semantic-release** that allows to publish releases with a [pre-release version](https://semver.org/#spec-item-9). Using a pre-release version allow to publish multiple releases with the same version. Those release will be differentiated via their identifiers (in `1.0.0-alpha.1` the identifier is `alpha.1`). This is useful when you need to work on a future major release that will include many breaking changes but you do not want to increment the version number for each breaking change commit. +A pre-release branch is a type of branch used by **semantic-release** that allows publishing releases with a [pre-release version](https://semver.org/#spec-item-9). Using a pre-release version allows publishing multiple releases with the same version. Those releases are differentiated via their identifiers (in `1.0.0-alpha.1`, the identifier is `alpha.1`). This is useful when you need to work on a future major release that will include many breaking changes, but you do not want to increment the version number for each breaking change commit. -A pre-release branch is characterized by the `prerelease` property that defines the static part of the version released (in `1.0.0-alpha.1` the static part fo the identifier is `alpha`). The [`prerelease`](workflow-configuration.md#prerelease) value of each pre-release branch must be unique across the project. +A pre-release branch is characterized by the `prerelease` property that defines the static part of the version released (in `1.0.0-alpha.1`, the static part of the identifier is `alpha`). The [`prerelease`](#prerelease) value of each pre-release branch must be unique across the project. **semantic-release** will always publish pre-releases to a specific distribution channel, so only the users who choose to use that particular line of versions will receive new releases. -When merging commits associated with an existing release, **semantic-release** will treat them as [pushed commits](workflow-configuration.md#pushing-to-a-pre-release-branch) and publish a new release if necessary, but it will never add those releases to the distribution channel corresponding to the pre-release branch. +When merging commits associated with an existing release, **semantic-release** will treat them as [pushed commits](#pushing-to-a-pre-release-branch) and publish a new release if necessary, but it will never add those releases to the distribution channel corresponding to the pre-release branch. -See [publishing pre-releases recipe](../recipes/release-workflow/pre-releases.md) for a detailed example. +See [publishing pre-releases recipe](/recipes/release-workflow/pre-releases) for a detailed example. #### Pushing to a pre-release branch diff --git a/src/content/docs/index.mdx b/src/content/docs/index.mdx index 95bd721..21bdd1e 100644 --- a/src/content/docs/index.mdx +++ b/src/content/docs/index.mdx @@ -39,7 +39,7 @@ import { Card, CardGrid } from "@astrojs/starlight/components"; Support any package manager and language via [plugins](/extending/plugins-list/). Use [shareable - configurations](/usage/shareable-configurations/) for simple, reusable + configurations](/foundation/shareable-configurations/) for simple, reusable setups. diff --git a/src/content/docs/intro.md b/src/content/docs/intro.md index abd3552..02a279b 100644 --- a/src/content/docs/intro.md +++ b/src/content/docs/intro.md @@ -2,12 +2,6 @@ title: "Introduction" --- -

Fully automated version management and package publishing

- -

Join the community on GitHub Discussions Build states OpenSSF Scorecard semantic-release: angular

- -

npm latest version npm next version npm beta version

- **semantic-release** automates the whole package release workflow including: determining the next version number, generating the release notes, and publishing the package. This removes the immediate connection between human emotions and version numbers, strictly following the [Semantic Versioning](http://semver.org) specification and communicating the **impact** of changes to consumers. @@ -22,10 +16,10 @@ This removes the immediate connection between human emotions and version numbers - Notify maintainers and users of new releases - Use formalized commit message convention to document changes in the codebase - Publish on different distribution channels (such as [npm dist-tags](https://docs.npmjs.com/cli/dist-tag)) based on git merges -- Integrate with your [continuous integration workflow](docs/recipes/release-workflow/#ci-configurations) +- Integrate with your [continuous integration workflow](/recipes/release-workflow/#ci-configurations) - Avoid potential errors associated with manual releases -- Support any [package managers and languages](docs/recipes/release-workflow/#package-managers-and-languages) via [plugins](docs/usage/plugins.md) -- Simple and reusable configuration via [shareable configurations](docs/usage/shareable-configurations.md) +- Support any [package managers and languages](/recipes/release-workflow/#package-managers-and-languages) via [plugins](/foundation/plugins) +- Simple and reusable configuration via [shareable configurations](/usage/shareable-configurations) - Support for [npm package provenance](https://github.com/semantic-release/npm#npm-provenance) that promotes increased supply-chain security via signed attestations on GitHub Actions ## How does it work? @@ -34,7 +28,7 @@ This removes the immediate connection between human emotions and version numbers **semantic-release** uses the commit messages to determine the consumer impact of changes in the codebase. Following formalized conventions for commit messages, **semantic-release** automatically determines the next [semantic version](https://semver.org) number, generates a changelog and publishes the release. -By default, **semantic-release** uses [Angular Commit Message Conventions](https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md). The commit message format can be changed with the [`preset` or `config` options](docs/usage/configuration.md#options) of the [@semantic-release/commit-analyzer](https://github.com/semantic-release/commit-analyzer#options) and [@semantic-release/release-notes-generator](https://github.com/semantic-release/release-notes-generator#options) plugins. +By default, **semantic-release** uses [Angular Commit Message Conventions](https://github.com/angular/angular/blob/main/contributing-/commit-message-guidelines.md). The commit message format can be changed with the [`preset` or `config` options](/usage/configuration#options) of the [@semantic-release/commit-analyzer](https://github.com/semantic-release/commit-analyzer#options) and [@semantic-release/release-notes-generator](https://github.com/semantic-release/release-notes-generator#options) plugins. Tools such as [commitizen](https://github.com/commitizen/cz-cli) or [commitlint](https://github.com/conventional-changelog/commitlint) can be used to help contributors and enforce valid commit messages. @@ -56,9 +50,9 @@ For each new commit added to one of the release branches (for example: `master`, **semantic-release** offers various ways to control the timing, the content and the audience of published releases. See example workflows in the following recipes: -- [Using distribution channels](docs/recipes/release-workflow/distribution-channels.md#publishing-on-distribution-channels) -- [Maintenance releases](docs/recipes/release-workflow/maintenance-releases.md#publishing-maintenance-releases) -- [Pre-releases](docs/recipes/release-workflow/pre-releases.md#publishing-pre-releases) +- [Using distribution channels](/recipes/release-workflow/distribution-channels) +- [Maintenance releases](/recipes/release-workflow/maintenance-releases) +- [Pre-releases](/recipes/release-workflow/pre-releases) ### Release steps @@ -81,9 +75,9 @@ After running the tests, the command `semantic-release` will execute the followi In order to use **semantic-release** you need: - To host your code in a [Git repository](https://git-scm.com) -- Use a Continuous Integration service that allows you to [securely set up credentials](docs/usage/ci-configuration.md#authentication) -- A Git CLI version that meets [our version requirement](docs/support/git-version.md) installed in your Continuous Integration environment -- A [Node.js](https://nodejs.org) version that meets [our version requirement](docs/support/node-version.md) installed in your Continuous Integration environment +- Use a Continuous Integration service that allows you to [securely set up credentials](/usage/ci-configuration#authentication) +- A Git CLI version that meets [our version requirement](/support/git-version) installed in your Continuous Integration environment +- A [Node.js](https://nodejs.org) version that meets [our version requirement](/support/node-version) installed in your Continuous Integration environment ## Get help diff --git a/src/content/docs/recipes/ci-configurations/circleci-workflows.md b/src/content/docs/recipes/ci-configurations/circleci-workflows.md index 3a51ea4..1b48a12 100644 --- a/src/content/docs/recipes/ci-configurations/circleci-workflows.md +++ b/src/content/docs/recipes/ci-configurations/circleci-workflows.md @@ -4,9 +4,9 @@ title: "CircleCI 2.0" ## Environment variables -The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured in [CircleCi Project Settings](https://circleci.com/docs/2.0/env-vars/#adding-environment-variables-in-the-app).. +The [Authentication](/usage/ci-configuration#authentication) environment variables can be configured in [CircleCi Project Settings](https://circleci.com/docs/2.0/env-vars/#adding-environment-variables-in-the-app).. -Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../../usage/getting-started.md#getting-started). +Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](/usage/getting-started). ## Multiple Node jobs configuration diff --git a/src/content/docs/recipes/ci-configurations/github-actions.md b/src/content/docs/recipes/ci-configurations/github-actions.md deleted file mode 100644 index 44e9cdc..0000000 --- a/src/content/docs/recipes/ci-configurations/github-actions.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -title: "GitHub Actions" ---- - -## Environment variables - -The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured with [Secret Variables](https://docs.github.com/en/actions/reference/encrypted-secrets). - -In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populate](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) a [`GITHUB_TOKEN`](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) environment variable which can be used in Workflows. - -## Trusted publishing and npm provenance - -For improved security and automation, it is recommended to leverage [trusted publishing](https://docs.npmjs.com/trusted-publishers) through [OpenID Connect (OIDC)](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect) when publishing to npm from GitHub Actions. GitHub Actions is a [trusted identity provider](https://docs.npmjs.com/trusted-publishers#identity-providers) for npm, enabling configuration of a trust relationship between your GitHub repository and npm so that no long-lived secret (like an `NPM_TOKEN`) is required to publish packages to npm from GitHub Actions. The npm registry [recently increased restrictions for use of long-lived access tokens](https://github.blog/changelog/2025-09-29-strengthening-npm-security-important-changes-to-authentication-and-token-management/), further encouraging trusted publishing as the preferred approach for publishing to npm from GitHub Actions. Enabling trusted publishing requires granting the `id-token: write` permission to the job performing the publish step and [configuring a trust relationship](https://docs.npmjs.com/trusted-publishers#step-1-add-a-trusted-publisher-on-npmjscom) between your GitHub repository and npm. - -**Note**: When setting up a Trusted Publisher on npmjs for GitHub Actions, it's crucial to specify the workflow file that triggers the release process, not necessarily the one that contains the release logic itself.\ -If your release job is encapsulated in a [reusable workflow](https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows), the workflow file you must reference is the caller workflow—typically the one triggered by events like `push` or `workflow_dispatch` on your main branch.\ -This is because npm's Trusted Publisher mechanism authorizes the workflow that initiates the run, not any downstream workflows it invokes. - -[npm provenance](https://docs.npmjs.com/generating-provenance-statements) is valuable for increasing supply-chain security for your npm packages. Before trusted publishing was available, generating provenance attestations required configuring your project to enable publishing with provenance. With trusted publishing, npm provenance is automatically generated for packages published to npm from GitHub Actions without any additional configuration. - -## Important: Avoid `registry-url` in `setup-node` - -**Do not** set the `registry-url` option in the `actions/setup-node` step when using semantic-release for npm publishing. The `registry-url` option causes `setup-node` to create an `.npmrc` file that can conflict with semantic-release's npm authentication mechanism, leading to `EINVALIDNPMTOKEN` errors even when your token is valid. - -```yaml -# ❌ Don't do this - can cause conflicts with semantic-release -- name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "lts/*" - registry-url: "https://registry.npmjs.org" - -# ✅ Do this instead - let semantic-release handle npm authentication -- name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "lts/*" -``` - -If you need to specify a custom registry, configure it in your project's `.npmrc` file instead. This ensures consistent behavior between local development and CI environments, and avoids conflicts with semantic-release. - -## Node project configuration - -[GitHub Actions](https://github.com/features/actions) support [Workflows](https://help.github.com/en/articles/configuring-workflows), allowing to run tests on multiple Node versions and publish a release only when all test pass. - -**Note**: The publish pipeline must run on a [Node version that meets our version requirement](../../support/node-version.md). - -### `.github/workflows/release.yml` configuration for Node projects - -The following is a minimal configuration for [`semantic-release`](https://github.com/semantic-release/semantic-release) with a build running on the latest LTS version of Node when a new commit is pushed to a `master/main` branch. See the [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions) for additional configuration options. - -```yaml -name: Release -on: - push: - branches: - - master # or main - -permissions: - contents: read # for checkout - -jobs: - release: - name: Release - runs-on: ubuntu-latest - permissions: - contents: write # to be able to publish a GitHub release - issues: write # to be able to comment on released issues - pull-requests: write # to be able to comment on released pull requests - id-token: write # to enable use of OIDC for trusted publishing and npm provenance - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "lts/*" - - name: Install dependencies - run: npm clean-install - - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies - run: npm audit signatures - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: npx semantic-release -``` - -## Pushing `package.json` changes to your repository - -If you choose to commit changes to your `package.json` [against our recommendation](../../support/FAQ.md#making-commits-during-the-release-process-adds-significant-complexity), the [`@semantic-release/git`](https://github.com/semantic-release/git) plugin can be used. - -**Note**: Automatically populated `GITHUB_TOKEN` cannot be used if branch protection is enabled for the target branch. It is **not** advised to mitigate this limitation by overriding an automatically populated `GITHUB_TOKEN` variable with a [Personal Access Tokens](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line), as it poses a security risk. Since Secret Variables are available for Workflows triggered by any branch, it becomes a potential vector of attack, where a Workflow triggered from a non-protected branch can expose and use a token with elevated permissions, yielding branch protection insignificant. One can use Personal Access Tokens in trusted environments, where all developers should have the ability to perform administrative actions in the given repository and branch protection is enabled solely for convenience purposes, to remind about required reviews or CI checks. - -If the risk is acceptable, some extra configuration is needed. The [actions/checkout `persist-credentials`](https://github.com/marketplace/actions/checkout#usage) option needs to be `false`, otherwise the generated `GITHUB_TOKEN` will interfere with the custom one. Example: - -```yaml -- name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - persist-credentials: false # <--- this -``` - -## Trigger semantic-release on demand - -### Using GUI: - -You can use [Manual Triggers](https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/) for GitHub Actions. - -### Using HTTP: - -Use [`repository_dispatch`](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch) event to have control on when to generate a release by making an HTTP request, e.g.: - -```yaml -name: Release -on: - repository_dispatch: - types: [semantic-release] -jobs: -# ... -``` - -To trigger a release, call (with a [Personal Access Tokens](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) stored in `GITHUB_TOKEN` environment variable): - -``` -$ curl -v -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/[org-name-or-username]/[repository]/dispatches -d '{ "event_type": "semantic-release" }' -``` diff --git a/src/content/docs/recipes/ci-configurations/github-actions.mdx b/src/content/docs/recipes/ci-configurations/github-actions.mdx new file mode 100644 index 0000000..9d00364 --- /dev/null +++ b/src/content/docs/recipes/ci-configurations/github-actions.mdx @@ -0,0 +1,247 @@ +--- +title: "GitHub Actions" +--- + +import { Steps } from "@astrojs/starlight/components"; + +Use this recipe to run semantic-release on GitHub Actions with a secure default setup. It covers authentication options, trusted publishing with OIDC and npm provenance, a minimal release workflow for Node projects, and common pitfalls to avoid when configuring npm and GitHub tokens. + +## Quick start + + + +1. Create `.github/workflows/verify-and-release.yml` using the [verify-and-release workflow configuration](#githubworkflowsverify-and-releaseyml-configuration-for-node-projects). +2. [Choose a publishing path](#choose-a-publishing-path). + - Use **trusted publishing** (recommended): follow [Path A](#path-a-recommended-trusted-publishing-oidc), then review [Trusted publishing and npm provenance](#trusted-publishing-and-npm-provenance). + - If you cannot use trusted publishing, add `NPM_TOKEN` as a GitHub Actions secret as described in [Environment variables](#environment-variables) and follow [Path B](#path-b-fallback-npm_token). +3. Push a commit to `main`/`master` (or run `workflow_dispatch`) and verify with the [Release readiness checklist](#release-readiness-checklist). For manual runs, see [Trigger semantic-release on demand](#trigger-semantic-release-on-demand). + + + +## Choose a publishing path + +### Path A (recommended): Trusted publishing (OIDC) + +- No long-lived npm token in GitHub secrets. +- npm provenance is generated automatically. +- Requires `id-token: write` permission in the job that runs semantic-release. +- Requires an npm [Trusted Publisher](https://docs.npmjs.com/trusted-publishers#for-github-actions) configured for the workflow that triggers the run. + +### Path B (fallback): `NPM_TOKEN` + +- Add `NPM_TOKEN` to repository or organization secrets. +- Keep `GITHUB_TOKEN` for GitHub release notes, issue comments, and pull request comments. +- Use this only when trusted publishing is not available for your setup. + +## Node project configuration + +[GitHub Actions](https://github.com/features/actions) supports [workflows](https://docs.github.com/en/actions/writing-workflows), allowing you to run tests on multiple Node versions and publish a release only when all tests pass. + +### `.github/workflows/verify-and-release.yml` configuration for Node projects + +Use this as a starting point for `.github/workflows/verify-and-release.yml`. This example runs verification first and only runs semantic-release if verification succeeds. Make sure to adjust the trigger and branch name as needed. The example below is configured for trusted publishing with OIDC, but it can be easily adapted to use `NPM_TOKEN` instead by removing the `id-token: write` permission and ensuring `NPM_TOKEN` is available in secrets. + +:::note +The publish pipeline must run on a [Node version that meets our version requirement](/support/node-version), but can be different than the Node version used in your verification job(s). +::: + +```yaml +name: Verify and Release +on: + push: + branches: + - main # or master + +permissions: + contents: read # for checkout + +jobs: + verify: + name: Verify + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + - name: Install dependencies + run: npm clean-install + - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies + run: npm audit signatures + - name: Run lint, tests, and other verification + run: npm test + + release: + name: Release + runs-on: ubuntu-latest + needs: verify + permissions: + contents: write # to be able to publish a GitHub release + issues: write # to be able to comment on released issues + pull-requests: write # to be able to comment on released pull requests + id-token: write # to enable use of OIDC for trusted publishing and npm provenance + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + - name: Install dependencies + run: npm clean-install + - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies + run: npm audit signatures + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release # <- The Run Commnand +``` + +The workflow above shows a verify-then-release setup with the default semantic-release flow. If your release process needs a different invocation style or non-default behavior (for example, plugins or shareable configurations), refer to [Running semantic-release](/usage/running). + +## Environment variables + +The [Authentication](/usage/ci-configuration#authentication) environment variables can be configured with [GitHub Actions secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions). + +If you are not using trusted publishing, an [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populates](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication) a [`GITHUB_TOKEN`](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication) environment variable that can be used in workflows. + +## Trusted publishing and npm provenance + +For improved security and automation, it is recommended to leverage [trusted publishing](https://docs.npmjs.com/trusted-publishers) through [OpenID Connect (OIDC)](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect) when publishing to npm from GitHub Actions. GitHub Actions is a [trusted identity provider](https://docs.npmjs.com/trusted-publishers#identity-providers) for npm, enabling configuration of a trust relationship between your GitHub repository and npm so that no long-lived secret (like an `NPM_TOKEN`) is required to publish packages to npm from GitHub Actions. The npm registry [recently increased restrictions for use of long-lived access tokens](https://github.blog/changelog/2025-09-29-strengthening-npm-security-important-changes-to-authentication-and-token-management/), further encouraging trusted publishing as the preferred approach for publishing to npm from GitHub Actions. Enabling trusted publishing requires granting the `id-token: write` permission to the job performing the publish step and [configuring a trust relationship](https://docs.npmjs.com/trusted-publishers#step-1-add-a-trusted-publisher-on-npmjscom) between your GitHub repository and npm. + +:::note +When setting up a Trusted Publisher on npmjs for GitHub Actions, it's crucial to specify the workflow file that triggers the release process, not necessarily the one that contains the release logic itself. + +If your release job is encapsulated in a [reusable workflow](https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows), the workflow file you must reference is the caller workflow—typically the one triggered by events like `push` or `workflow_dispatch` on your main branch. + +This is because npm's Trusted Publisher mechanism authorizes the workflow that initiates the run, not any downstream workflows it invokes. +::: + +[npm provenance](https://docs.npmjs.com/generating-provenance-statements) is valuable for increasing supply-chain security for your npm packages. Before trusted publishing was available, generating provenance attestations required configuring your project to enable publishing with provenance. With trusted publishing, npm provenance is automatically generated for packages published to npm from GitHub Actions without any additional configuration. + +## Common pitfalls checklist + +- Do not set `registry-url` in `actions/setup-node` when using semantic-release for npm publishing. It creates an `.npmrc` that can conflict with semantic-release auth and lead to `EINVALIDNPMTOKEN` errors. +- If you need a custom npm registry, set it in your project `.npmrc`. +- If using npm trusted publishing, keep `id-token: write` permission in the release job. +- If using `NPM_TOKEN`, ensure it is configured as a repository or organization secret. + +```yaml +# ❌ Don't do this - can cause conflicts with semantic-release +- name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + registry-url: "https://registry.npmjs.org" + +# ✅ Do this instead - let semantic-release handle registry configuration through normal npm conventions +- name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "lts/*" +``` + +## Pushing `package.json` changes to your repository + +If you choose to commit changes to your `package.json` [against our recommendation](/support/faq#making-commits-during-the-release-process-adds-significant-complexity), the [`@semantic-release/git`](https://github.com/semantic-release/git) plugin can be used. + +:::note +The automatically populated `GITHUB_TOKEN` cannot be used if branch protection is enabled for the target branch. In that case, prefer [GitHub App authentication](https://github.com/actions/create-github-app-token) so the release job can create commits without relying on a long-lived secret. + +Personal Access Tokens are not recommended here. They create a broader security risk because a secret exposed to any workflow run can be reused with elevated permissions, which makes branch protection much less effective. Only consider a PAT in tightly controlled environments where the security tradeoff is acceptable. +::: + +Example release job using GitHub App authentication with `@semantic-release/git` (assuming a preceding `verify` job): + +```yaml +# verify: +# # ... your existing verify job + +release: + name: Release + runs-on: ubuntu-latest + needs: verify + permissions: + contents: write + issues: write + pull-requests: write + id-token: write + steps: + - name: Create GitHub App token + id: app-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.RELEASE_APP_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ steps.app-token.outputs.token }} + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + - name: Install dependencies + run: npm clean-install + - name: Release + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + run: npx semantic-release +``` + +## Release readiness checklist + +- Your workflow triggers on the branch you release from (`main` or `master`). +- `fetch-depth: 0` is enabled in checkout. +- `GITHUB_TOKEN` is available to semantic-release for the default release flow. +- If you commit files during release on a protected branch (for example with `@semantic-release/git`), GitHub App auth is configured and checkout uses the app token. +- You chose one npm auth path: trusted publishing (`id-token: write`) or `NPM_TOKEN` secret. +- `registry-url` is not set in `actions/setup-node`. +- Your runtime meets the [supported Node version policy](/support/node-version). + +## Trigger semantic-release on demand + +Use these options when you want to trigger a release outside the normal push-based workflow. + +:::caution[Discouraged in most setups] +Manual or API-triggered releases are generally **not recommended** with semantic-release. + +semantic-release is designed for continuous delivery: once changes are merged to your primary release branch, releases should happen automatically and predictably from CI. Adding ad-hoc triggers increases operational complexity, weakens release consistency, and can bypass the normal branch-based release flow your team relies on. + +Use the options below only for exceptional operational scenarios. +::: + +### Using GUI + +You can use [`workflow_dispatch`](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onworkflow_dispatch) to run the release workflow manually from the GitHub UI. + +### Using HTTP + +Use the [`repository_dispatch`](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#repository_dispatch) event to control when to generate a release by making an HTTP request, for example: + +```yaml +name: Release +on: + repository_dispatch: + types: [semantic-release] +jobs: +# ... +``` + +To trigger a release, call the GitHub API with a [Personal Access Token](https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api) stored in the `GITHUB_TOKEN` environment variable: + +``` +$ curl -v -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/[org-name-or-username]/[repository]/dispatches \ + -d '{ "event_type": "semantic-release" }' +``` diff --git a/src/content/docs/recipes/ci-configurations/gitlab-ci.md b/src/content/docs/recipes/ci-configurations/gitlab-ci.md index 7d1ad73..4f9a61b 100644 --- a/src/content/docs/recipes/ci-configurations/gitlab-ci.md +++ b/src/content/docs/recipes/ci-configurations/gitlab-ci.md @@ -4,7 +4,7 @@ title: "GitLab CI" ## Environment variables -The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured with [Protected variables](https://docs.gitlab.com/ce/ci/variables/README.html#protected-environment-variables). +The [Authentication](/usage/ci-configuration#authentication) environment variables can be configured with [Protected variables](https://docs.gitlab.com/ce/ci/variables/README.html#protected-environment-variables). **Note**: Make sure to configure your release branch as [protected](https://docs.gitlab.com/ce/user/project/protected_branches.html) in order for the CI/CD build to access the protected variables. @@ -16,13 +16,13 @@ Since GitLab CI is a [supported provider](https://docs.npmjs.com/generating-prov GitLab CI supports [Pipelines](https://docs.gitlab.com/ee/ci/pipelines.html) allowing to test on multiple Node versions and publishing a release only when all test pass. -**Note**: The publish pipeline must run a [Node version that meets our version requirement](../../support/node-version.md). +**Note**: The publish pipeline must run a [Node version that meets our version requirement](/support/node-version). ### `.gitlab-ci.yml` configuration for Node projects This example is a minimal configuration for **semantic-release** with a build running Node 10 and 12. See [GitLab CI - Configuration of your jobs with `.gitlab-ci.yml`](https://docs.gitlab.com/ee/ci/yaml/README.html) for additional configuration options. -**Note**: The`semantic-release` execution command varies depending on whether you are using a [local](../../usage/installation.md#local-installation) or [global](../../usage/installation.md#global-installation) **semantic-release** installation. +**Note**: The`semantic-release` execution command varies depending on whether you are using a [local](/usage/running#local-installation-not-recommended) or [global](/usage/running#using-npx-recommended) **semantic-release** installation. ```yaml # The release pipeline will run only if all jobs in the test pipeline are successful @@ -56,7 +56,7 @@ publish: This example is a minimal configuration for **semantic-release** with a build running Node 10 and 12. See [GitLab CI - Configuration of your jobs with `.gitlab-ci.yml`](https://docs.gitlab.com/ee/ci/yaml/README.html) for additional configuration options. -**Note**: The`semantic-release` execution command varies depending if you are using a [local](../../usage/installation.md#local-installation) or [global](../../usage/installation.md#global-installation) **semantic-release** installation. +**Note**: The`semantic-release` execution command varies depending if you are using a [local](/usage/running#local-installation-not-recommended) or [global](/usage/running#using-npx-recommended) **semantic-release** installation. ```yaml # The release pipeline will run only on the master/main branch a commit is triggered @@ -88,7 +88,7 @@ release: ### `package.json` configuration -A `package.json` is required only for [local](../../usage/installation.md#local-installation) **semantic-release** installation. +A `package.json` is required only for [local](/usage/running#local-installation-not-recommended) **semantic-release** installation. ```json { diff --git a/src/content/docs/recipes/ci-configurations/index.md b/src/content/docs/recipes/ci-configurations/index.md deleted file mode 100644 index 618045f..0000000 --- a/src/content/docs/recipes/ci-configurations/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "CI configurations" ---- - -- [CircleCI 2.0 workflows](circleci-workflows.md) -- [Travis CI](travis.md) -- [GitLab CI](gitlab-ci.md) -- [GitHub Actions](github-actions.md) -- [Jenkins CI](jenkins-ci.md) diff --git a/src/content/docs/recipes/ci-configurations/index.mdx b/src/content/docs/recipes/ci-configurations/index.mdx new file mode 100644 index 0000000..075543b --- /dev/null +++ b/src/content/docs/recipes/ci-configurations/index.mdx @@ -0,0 +1,37 @@ +--- +title: "CI configurations" +--- + +import { CardGrid, LinkCard } from "@astrojs/starlight/components"; + + + + + + + + + + + + diff --git a/src/content/docs/recipes/ci-configurations/jenkins-ci.md b/src/content/docs/recipes/ci-configurations/jenkins-ci.md index c6b5a60..25fe808 100644 --- a/src/content/docs/recipes/ci-configurations/jenkins-ci.md +++ b/src/content/docs/recipes/ci-configurations/jenkins-ci.md @@ -4,15 +4,15 @@ title: "Jenkins CI" ## Environment variables -The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured in [Jenkins Project Settings](https://www.jenkins.io/doc/pipeline/tour/environment/).. +The [Authentication](/usage/ci-configuration#authentication) environment variables can be configured in [Jenkins Project Settings](https://www.jenkins.io/doc/pipeline/tour/environment/).. -Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../../usage/getting-started.md#getting-started). +Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](/usage/getting-started). ## Node.js project configuration ### `Jenkinsfile (Declarative Pipeline)` configuration for a Node.js job -**Note**: The publish pipeline must run a Node version that [meets our requirement](../../support/node-version.md). +**Note**: The publish pipeline must run a Node version that [meets our requirement](/support/node-version). This example is a minimal configuration for **semantic-release** with a build running a version of Node labelled as "node LTS". Since versions of Node are manually downloaded and labelled, we recommend keeping the version used for the release steps up-to-date with the latest LTS version. See the [Jenkins documentation](https://www.jenkins.io/doc/) for additional configuration options. @@ -50,7 +50,7 @@ pipeline { ### `package.json` configuration for a Node job -A `package.json` is required only for [local](../../usage/installation.md#local-installation) **semantic-release** installation. +A `package.json` is required only for [local](/usage/running#local-installation-not-recommended) **semantic-release** installation. ```json { diff --git a/src/content/docs/recipes/ci-configurations/travis.md b/src/content/docs/recipes/ci-configurations/travis.md index cdff648..76a98b2 100644 --- a/src/content/docs/recipes/ci-configurations/travis.md +++ b/src/content/docs/recipes/ci-configurations/travis.md @@ -4,9 +4,9 @@ title: "Travis CI" ## Environment variables -The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured in [Travis Repository Settings](https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-Settings) or with the [travis env set CLI](https://github.com/travis-ci/travis.rb#env). +The [Authentication](/usage/ci-configuration#authentication) environment variables can be configured in [Travis Repository Settings](https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-Settings) or with the [travis env set CLI](https://github.com/travis-ci/travis.rb#env). -Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../../usage/getting-started.md#getting-started). +Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](/usage/getting-started). ## Node.js projects configuration @@ -14,7 +14,7 @@ Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with This example is a minimal configuration for **semantic-release** with a build running Node 14 and 16. See [Travis - Customizing the Build](https://docs.travis-ci.com/user/customizing-the-build) for additional configuration options. -This example creates a `release` [build stage](https://docs.travis-ci.com/user/build-stages) that [runs `semantic-release` only after all test jobs are successful](../../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded). +This example creates a `release` [build stage](https://docs.travis-ci.com/user/build-stages) that [runs `semantic-release` only after all test jobs are successful](/usage/ci-configuration#run-semantic-release-only-after-all-tests-succeeded). It's recommended to run the `semantic-release` command in the [Travis `deploy` step](https://docs.travis-ci.com/user/customizing-the-build/#The-Build-Lifecycle) so if an error occurs the build will fail and Travis will send a notification. @@ -45,7 +45,7 @@ jobs: ### `package.json` configuration for multiple Node jobs -A `package.json` is required only for [local](../../usage/installation.md#local-installation) **semantic-release** installation. +A `package.json` is required only for [local](/usage/running#local-installation-not-recommended) **semantic-release** installation. ```json { @@ -59,13 +59,13 @@ A `package.json` is required only for [local](../../usage/installation.md#local- For projects that require to be tested with one or multiple version of a Non-JavaScript [language](https://docs.travis-ci.com/user/languages), optionally on multiple [Operating Systems](https://docs.travis-ci.com/user/multi-os). -This recipe cover the Travis specifics only. See [Non JavaScript projects recipe](../../support/FAQ.md#can-i-use-semantic-release-to-publish-non-javascript-packages) for more information on the **semantic-release** configuration. +This recipe cover the Travis specifics only. See [Non JavaScript projects recipe](/support/faq#can-i-use-semantic-release-to-publish-non-javascript-packages) for more information on the **semantic-release** configuration. ### `.travis.yml` configuration for non-JavaScript projects This example is a minimal configuration for **semantic-release** with a build running [Go 1.6 and 1.7](https://docs.travis-ci.com/user/languages/go). See [Travis - Customizing the Build](https://docs.travis-ci.com/user/customizing-the-build) for additional configuration options. -This example creates a `release` [build stage](https://docs.travis-ci.com/user/build-stages) that [runs `semantic-release` only after all test jobs are successful](../../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded). +This example creates a `release` [build stage](https://docs.travis-ci.com/user/build-stages) that [runs `semantic-release` only after all test jobs are successful](/usage/ci-configuration#run-semantic-release-only-after-all-tests-succeeded). It's recommended to run the `semantic-release` command in the [Travis `deploy` step](https://docs.travis-ci.com/user/customizing-the-build/#The-Build-Lifecycle) so if an error occurs the build will fail and Travis will send a notification. diff --git a/src/content/docs/recipes/git-hosted-services/git-auth-ssh-keys.md b/src/content/docs/recipes/git-hosted-services/git-auth-ssh-keys.md index 558281c..c1c9ed5 100644 --- a/src/content/docs/recipes/git-hosted-services/git-auth-ssh-keys.md +++ b/src/content/docs/recipes/git-hosted-services/git-auth-ssh-keys.md @@ -2,7 +2,7 @@ title: "Git authentication with SSH keys" --- -When using [environment variables](../../usage/ci-configuration.md#authentication) to set up the Git authentication, the remote Git repository will automatically be accessed via [https](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_the_http_protocols), independently of the [`repositoryUrl`](../../usage/configuration.md#repositoryurl) format configured in the **semantic-release** [Configuration](../../usage/configuration.md#configuration) (the format will be automatically converted as needed). +When using [environment variables](/usage/ci-configuration#authentication) to set up the Git authentication, the remote Git repository will automatically be accessed via [https](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_the_http_protocols), independently of the [`repositoryUrl`](/usage/configuration#repositoryurl) format configured in the **semantic-release** [Configuration](/usage/configuration) (the format will be automatically converted as needed). Alternatively the Git repository can be accessed via [SSH](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_the_ssh_protocol) by creating SSH keys, adding the public one to your Git hosted account and making the private one available on the CI environment. @@ -24,7 +24,7 @@ This will generate a public key in `git_deploy_key.pub` and a private key in `gi Step by step instructions are provided for the following Git hosted services: -- [GitHub](git-auth-ssh-keys.md#adding-the-ssh-public-key-to-github) +- [GitHub](#adding-the-ssh-public-key-to-github) ### Adding the SSH public key to GitHub @@ -48,8 +48,8 @@ In order to be available on the CI environment, the SSH private key must be encr Step by step instructions are provided for the following environments: -- [Travis CI](git-auth-ssh-keys.md#adding-the-ssh-private-key-to-travis-ci) -- [Circle CI](git-auth-ssh-keys.md#adding-the-ssh-private-key-to-circle-ci) +- [Travis CI](#adding-the-ssh-private-key-to-travis-ci) +- [Circle CI](#adding-the-ssh-private-key-to-circle-ci) ### Adding the SSH private key to Travis CI @@ -65,7 +65,7 @@ $ gem install travis $ travis login ``` -Add the [environment](https://github.com/travis-ci/travis.rb#env) variable `SSH_PASSPHRASE` to Travis with the value set during the [SSH keys generation](git-auth-ssh-keys.md#generating-the-ssh-keys) step: +Add the [environment](https://github.com/travis-ci/travis.rb#env) variable `SSH_PASSPHRASE` to Travis with the value set during the [SSH keys generation](#generating-the-ssh-keys) step: ```bash $ travis env set SSH_PASSPHRASE @@ -124,7 +124,7 @@ iv =VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV Add the following [environment variables](https://circleci.com/docs/2.0/env-vars/#adding-environment-variables-in-the-app) to Circle CI: -- `SSL_PASSPHRASE` - the value set during the [SSH keys generation](git-auth-ssh-keys.md#generating-the-ssh-keys) step. +- `SSL_PASSPHRASE` - the value set during the [SSH keys generation](#generating-the-ssh-keys) step. - `REPO_ENC_KEY` - the `key` (KKK) value from the `openssl` step above. - `REPO_ENC_IV` - the `iv` (VVV) value from the `openssl` step above. diff --git a/src/content/docs/recipes/git-hosted-services/index.md b/src/content/docs/recipes/git-hosted-services/index.md index 37807ca..b83fa9c 100644 --- a/src/content/docs/recipes/git-hosted-services/index.md +++ b/src/content/docs/recipes/git-hosted-services/index.md @@ -2,4 +2,4 @@ title: "Git hosted services" --- -- [Git authentication with SSH keys](git-auth-ssh-keys.md) +- [Git authentication with SSH keys](git-auth-ssh-keys) diff --git a/src/content/docs/recipes/release-workflow/distribution-channels.md b/src/content/docs/recipes/release-workflow/distribution-channels.md index 0acde44..dc78332 100644 --- a/src/content/docs/recipes/release-workflow/distribution-channels.md +++ b/src/content/docs/recipes/release-workflow/distribution-channels.md @@ -6,8 +6,8 @@ This recipe will walk you through a simple example that uses distribution channe This example uses the **semantic-release** default configuration: -- [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` -- [plugins](../../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']` +- [branches](/usage/configuration#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` +- [plugins](/usage/configuration#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']` ## Initial release diff --git a/src/content/docs/recipes/release-workflow/index.md b/src/content/docs/recipes/release-workflow/index.md index d6a46d5..2f69a69 100644 --- a/src/content/docs/recipes/release-workflow/index.md +++ b/src/content/docs/recipes/release-workflow/index.md @@ -2,6 +2,6 @@ title: "Release Workflow" --- -- [Publishing on distribution channels](distribution-channels.md) -- [Publishing maintenance releases](maintenance-releases.md) -- [Publishing pre-releases](pre-releases.md) +- [Publishing on distribution channels](distribution-channels) +- [Publishing maintenance releases](maintenance-releases) +- [Publishing pre-releases](pre-releases) diff --git a/src/content/docs/recipes/release-workflow/maintenance-releases.md b/src/content/docs/recipes/release-workflow/maintenance-releases.md index 780ced0..95fa6a3 100644 --- a/src/content/docs/recipes/release-workflow/maintenance-releases.md +++ b/src/content/docs/recipes/release-workflow/maintenance-releases.md @@ -6,8 +6,8 @@ This recipe will walk you through a simple example that uses Git branches and di This example uses the **semantic-release** default configuration: -- [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` -- [plugins](../../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']` +- [branches](/usage/configuration#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` +- [plugins](/usage/configuration#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']` ## Initial release diff --git a/src/content/docs/recipes/release-workflow/pre-releases.md b/src/content/docs/recipes/release-workflow/pre-releases.md index 8f10054..6c3a796 100644 --- a/src/content/docs/recipes/release-workflow/pre-releases.md +++ b/src/content/docs/recipes/release-workflow/pre-releases.md @@ -6,8 +6,8 @@ This recipe will walk you through a simple example that uses pre-releases to pub This example uses the **semantic-release** default configuration: -- [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` -- [plugins](../../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']` +- [branches](/usage/configuration#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` +- [plugins](/usage/configuration#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']` ## Initial release diff --git a/src/content/docs/support/FAQ.md b/src/content/docs/support/FAQ.md index e8d8956..9746944 100644 --- a/src/content/docs/support/FAQ.md +++ b/src/content/docs/support/FAQ.md @@ -35,7 +35,7 @@ However, if you are choosing to follow this path because you can't use the offic ## Should release notes be committed to a `CHANGELOG.md` in my repository during a release? -[`@semantic-release/changelog`](https://github.com/semantic-release/changelog) can be used to add release notes to a `CHANGELOG.md` file within your repository as part of each release. Committing changes to a `CHANGELOG.md` or similar file introduces the same [complexities](FAQ.md#making-commits-during-the-release-process-adds-significant-complexity) as committing an updated version within a `package.json` file. In addition, the release notes that would be added to a changelog file are likely redundant with the release notes added as GitHub releases, if that is also configured for your project (enabled by default). +[`@semantic-release/changelog`](https://github.com/semantic-release/changelog) can be used to add release notes to a `CHANGELOG.md` file within your repository as part of each release. Committing changes to a `CHANGELOG.md` or similar file introduces the same [complexities](#making-commits-during-the-release-process-adds-significant-complexity) as committing an updated version within a `package.json` file. In addition, the release notes that would be added to a changelog file are likely redundant with the release notes added as GitHub releases, if that is also configured for your project (enabled by default). Before deciding that a changelog file is necessary for your project, please consider whether the added complexity is worth it when GitHub releases (or similar for your host, if not GitHub) might accomplish the same goal. It could also be worth considering whether having a `CHANGELOG.md` in your repository that only contains a link to the project's GitHub releases could be an acceptable middle ground. @@ -70,7 +70,7 @@ If using npm hook scripts is not possible, and alternative solution is to [`@sem ## Is there a way to preview which version would currently get published? -Yes with the [dry-run options](../usage/configuration.md#dryrun) which prints to the console the next version to be published and the release notes. +Yes with the [dry-run options](/usage/configuration#dryrun) which prints to the console the next version to be published and the release notes. ## Can I use semantic-release to publish non-JavaScript packages? @@ -78,13 +78,13 @@ Yes, **semantic-release** is a Node CLI application, but it can be used to publi To publish a non-Node package (without a `package.json`) you would need to: -- Use a [global](../usage/installation.md#global-installation) **semantic-release** installation -- Set **semantic-release** [options](../usage/configuration.md#options) via [CLI arguments or `.rc` file](../usage/configuration.md#configuration) -- Make sure your CI job executing the `semantic-release` command has access to a version of Node that [meets our version requirement](node-version.md) to execute the `semantic-release` command +- Use a [global](/usage/running#using-npx-recommended) **semantic-release** installation +- Set **semantic-release** [options](/usage/configuration#options) via [CLI arguments or Configuration file](/usage/configuration) +- Make sure your CI job executing the `semantic-release` command has access to a version of Node that [meets our version requirement](/support/node-version) to execute the `semantic-release` command -See the [CI configuration recipes](../recipes/release-workflow/#ci-configurations) for more details on specific CI environments. +See the [CI configuration recipes](/recipes/release-workflow/#ci-configurations) for more details on specific CI environments. -In addition, you will need to configure the **semantic-release** [plugins](../usage/plugins.md#plugins) to disable the [`@semantic-release/npm`](https://github.com/semantic-release/npm) plugin which is used by default and use a plugin for your project type. +In addition, you will need to configure the **semantic-release** [plugins](/foundation/plugins) to disable the [`@semantic-release/npm`](https://github.com/semantic-release/npm) plugin which is used by default and use a plugin for your project type. If there is no specific plugin for your project type you can use the [`@semantic-release/exec`](https://github.com/semantic-release/exec) plugin to publish the release with a shell command. @@ -109,20 +109,20 @@ Here is a basic example to create [GitHub releases](https://help.github.com/arti **Note**: This is a theoretical example where the command `set-version` update the project version with the value passed as its first argument and `publish-package` publishes the package to a registry. -See the [package managers and languages recipes](../recipes/release-workflow/#package-managers-and-languages) for more details on specific project types and the [available plugins list](../extending/plugins-list.md) to see if there are community-supported plugins already available for the stack you are interested in. +See the [package managers and languages recipes](/recipes/release-workflow/#package-managers-and-languages) for more details on specific project types and the [available plugins list](/extending/plugins-list) to see if there are community-supported plugins already available for the stack you are interested in. ## Can I use semantic-release with any CI service? Yes, **semantic-release** can be used with any CI service, as long as it provides: -- A way to set [authentication](../usage/ci-configuration.md#authentication) via environment variables -- A way to guarantee that the `semantic-release` command is [executed only after all the tests of all the jobs in the CI build pass](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded) +- A way to set [authentication](/usage/ci-configuration#authentication) via environment variables +- A way to guarantee that the `semantic-release` command is [executed only after all the tests of all the jobs in the CI build pass](/usage/ci-configuration#run-semantic-release-only-after-all-tests-succeeded) -See the [CI configuration recipes](../recipes/release-workflow/#ci-configurations) for more details on specific CI environments. +See the [CI configuration recipes](/recipes/release-workflow/#ci-configurations) for more details on specific CI environments. ## Can I run semantic-release on my local machine rather than on a CI server? -Yes, you can by explicitly setting the [`--no-ci` CLI option](../usage/configuration.md#ci) option. You will also have to set the required [authentication](../usage/ci-configuration.md#authentication) via environment variables on your local machine, for example: +Yes, you can by explicitly setting the [`--no-ci` CLI option](/usage/configuration#ci) option. You will also have to set the required [authentication](/usage/ci-configuration#authentication) via environment variables on your local machine, for example: ```bash $ NPM_TOKEN= GH_TOKEN= npx semantic-release --no-ci @@ -134,11 +134,11 @@ However this is not the recommended approach, as running unit and integration te Yes, with the [`@semantic-release/gitlab-config`](https://github.com/semantic-release/gitlab-config) shareable configuration. -See the [GitLab CI recipes](../recipes/ci-configurations/gitlab-ci.md#using-semantic-release-with-gitlab-ci) for the CI configuration. +See the [GitLab CI recipes](/recipes/ci-configurations/gitlab-ci) for the CI configuration. ## Can I use semantic-release with any Git hosted environment? -By default **semantic-release** uses the [`@semantic-release/github`](https://github.com/semantic-release/github) plugin to publish a [GitHub release](https://help.github.com/articles/about-releases). For other Git hosted environment the [`@semantic-release/git`](https://github.com/semantic-release/git) and [`@semantic-release/changelog`](https://github.com/semantic-release/changelog) plugins can be used via [plugins configuration](../usage/plugins.md). +By default **semantic-release** uses the [`@semantic-release/github`](https://github.com/semantic-release/github) plugin to publish a [GitHub release](https://help.github.com/articles/about-releases). For other Git hosted environment the [`@semantic-release/git`](https://github.com/semantic-release/git) and [`@semantic-release/changelog`](https://github.com/semantic-release/changelog) plugins can be used via [plugins configuration](/foundation/plugins). See the [`@semantic-release/git`](https://github.com/semantic-release/git#semantic-releasegit) [`@semantic-release/changelog`](https://github.com/semantic-release/changelog#semantic-releasechangelog) plugins documentation for more details. @@ -218,15 +218,15 @@ From [Understanding the GitHub Flow](https://guides.github.com/introduction/flow > Branching is a core concept in Git, and the entire GitHub Flow is based upon it. There's only one rule: anything in the master/main branch is always deployable. -If you need more control over the timing of releases, see [Triggering a release](../../#triggering-a-release) for different options. +If you need more control over the timing of releases, see [Triggering a release](/intro#triggering-a-release) for different options. -**Note**: Only the codebase changes altering the published package will trigger a release (for example new features, bug fixes or performance improvements would trigger a release while refactoring or changing code style would not). See [How can I change the type of commits that trigger a release?](FAQ.md#how-can-i-change-the-type-of-commits-that-trigger-a-release) for more details. +**Note**: Only the codebase changes altering the published package will trigger a release (for example new features, bug fixes or performance improvements would trigger a release while refactoring or changing code style would not). See [How can I change the type of commits that trigger a release?](#how-can-i-change-the-type-of-commits-that-trigger-a-release) for more details. ## Can I set the initial release version of my package to `0.0.1`? This is not supported by semantic-release. [Semantic Versioning](https://semver.org/) rules apply differently to major version zero and supporting those differences is out of scope and not one of the goals of the semantic-release project. -If your project is under heavy development, with frequent breaking changes, and is not production ready yet we recommend [publishing pre-releases](../recipes/release-workflow/pre-releases.md#publishing-pre-releases). +If your project is under heavy development, with frequent breaking changes, and is not production ready yet we recommend [publishing pre-releases](/recipes/release-workflow/pre-releases). See [“Introduction to SemVer” - Irina Gebauer](https://blog.greenkeeper.io/introduction-to-semver-d272990c44f2) for more details on [Semantic Versioning](https://semver.org) and the recommendation to start at version `1.0.0`. @@ -234,7 +234,7 @@ See [“Introduction to SemVer” - Irina Gebauer](https://blog.greenkeeper.io/i **semantic-release** has a full unit and integration test suite that tests `npm` publishes against the [verdaccio](https://www.npmjs.com/package/verdaccio). -In addition, the [verify conditions step](../../#release-steps) verifies that all necessary conditions for proceeding with a release are met, and a new release will be performed [only if all your tests pass](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded). +In addition, the [verify conditions step](/foundation/release-steps) verifies that all necessary conditions for proceeding with a release are met, and a new release will be performed [only if all your tests pass](/usage/ci-configuration#run-semantic-release-only-after-all-tests-succeeded). ## What is npx? diff --git a/src/content/docs/support/node-version.md b/src/content/docs/support/node-version.md index b088ac8..9c0b75d 100644 --- a/src/content/docs/support/node-version.md +++ b/src/content/docs/support/node-version.md @@ -6,7 +6,7 @@ title: "Node version requirement" **semantic-release** is meant to be used in a CI environment as a development support tool, not as a production dependency. Therefore, the only constraint is to run the `semantic-release` in a CI environment providing version of Node that meets our version requirement. -See our [Node Support Policy](node-support-policy.md) for our long-term promise regarding Node version support. +See our [Node Support Policy](/support/node-support-policy) for our long-term promise regarding Node version support. ## Recommended solution @@ -14,7 +14,7 @@ See our [Node Support Policy](node-support-policy.md) for our long-term promise The recommended approach is to run the `semantic-release` command from a CI job running on the latest available LTS version of node. This can either be a job used by your project to test on the latest Node LTS version or a dedicated job for the release steps. -See [CI configuration](../usage/ci-configuration.md) and [CI configuration recipes](../recipes/ci-configurations/#ci-configurations) for more details. +See [CI configuration](/usage/ci-configuration) and [CI configuration recipes](/recipes/ci-configurations/#ci-configurations) for more details. ## Alternative solutions @@ -26,7 +26,7 @@ See [CI configuration](../usage/ci-configuration.md) and [CI configuration recip $ npx -p node@v24 -c "npx semantic-release" ``` -**Note**: See [What is npx](FAQ.md#what-is-npx) for more details. +**Note**: See [What is npx](/faq#what-is-npx) for more details. ### Use `nvm` diff --git a/src/content/docs/usage/ci-configuration.md b/src/content/docs/usage/ci-configuration.md index 59a2769..e5a4802 100644 --- a/src/content/docs/usage/ci-configuration.md +++ b/src/content/docs/usage/ci-configuration.md @@ -2,50 +2,65 @@ title: "CI Configuration" --- -## Run `semantic-release` only after all tests succeeded +Configure CI to run **semantic-release** by following two requirements: run it only after all tests pass, and configure the authentication needed to publish releases. + +## Choose your CI Service + +Start by choosing your CI service. Each guide shows provider-specific syntax for applying the same core requirements on this page. -The `semantic-release` command must be executed only after all the tests in the CI build pass. If the build runs multiple jobs (for example to test on multiple Operating Systems or Node versions) the CI has to be configured to guarantee that the `semantic-release` command is executed only after all jobs are successful. Here are a few examples of the CI services that can be used to achieve this: +- [GitHub Actions](/recipes/ci-configurations/github-actions) +- [GitLab CI](/recipes/ci-configurations/gitlab-ci) +- [CircleCI workflows](/recipes/ci-configurations/circleci-workflows) +- [Travis CI](/recipes/ci-configurations/travis) +- [Jenkins CI](/recipes/ci-configurations/jenkins-ci) -- [Travis Build Stages](https://docs.travis-ci.com/user/build-stages) -- [CircleCI Workflows](https://circleci.com/docs/2.0/workflows) -- [GitHub Actions](https://github.com/features/actions) -- [Codeship Deployment Pipelines](https://documentation.codeship.com/basic/builds-and-configuration/deployment-pipelines) -- [GitLab Pipelines](https://docs.gitlab.com/ee/ci/pipelines/) -- [Codefresh Pipelines](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/introduction-to-codefresh-pipelines) -- [Wercker Workflows](http://devcenter.wercker.com/docs/workflows) -- [GoCD Pipelines](https://docs.gocd.org/current/introduction/concepts_in_go.html#pipeline). +:::note +Whether your CI service is listed above or not, follow the same requirements below: [run `semantic-release` only after all tests succeeded](#run-semantic-release-only-after-all-tests-succeeded) and configure [authentication](#authentication). Then adapt those steps to your provider's syntax. -See [CI configuration recipes](../recipes/ci-configurations/) for more details. +For details about the CI environment variables that **semantic-release** detects, see [env-ci](https://github.com/semantic-release/env-ci/). +::: + +## Run `semantic-release` only after all tests succeeded + +The `semantic-release` command must be executed only after all the tests in the CI build pass. If the build runs multiple jobs (for example to test on multiple Operating Systems or Node versions) the CI has to be configured to guarantee that the `semantic-release` command is executed only after all jobs are successful. ## Authentication +**semantic-release** requires authentication to push to your repository and publish releases. Several authentication methods are available depending on your CI service and repository hosting platform. + +:::note +Prefer short-lived credentials over long-lived secrets when your platform supports them (for example, OIDC-based trusted publishing or GitHub App installation tokens). +::: + ### Push access to the remote repository **semantic-release** requires push access to the project Git repository in order to create [Git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging). The Git authentication can be set with one of the following environment variables: -| Variable | Description | -| ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `GH_TOKEN` or `GITHUB_TOKEN` | A GitHub [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line). | -| `GL_TOKEN` or `GITLAB_TOKEN` | A GitLab [personal access token](https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html). | -| `BB_TOKEN` or `BITBUCKET_TOKEN` | A Bitbucket [personal access token](https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html). | -| `BB_TOKEN_BASIC_AUTH` or `BITBUCKET_TOKEN_BASIC_AUTH` | A Bitbucket [personal access token](https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html) with basic auth support. For clarification `user:token` has to be the value of this env. | -| `GIT_CREDENTIALS` | [URL encoded](https://en.wikipedia.org/wiki/Percent-encoding) Git username and password in the format `:`. The username and password must each be individually URL encoded, not the `:` separating them. | +| Variable | Description | +| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `GH_TOKEN` or `GITHUB_TOKEN` | GitHub token for repository authentication. In GitHub Actions, the workflow-provided `GITHUB_TOKEN` is automatically available; prefer this or a GitHub App installation token when available; use a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) only when required. | +| `GL_TOKEN` or `GITLAB_TOKEN` | A GitLab [personal access token](https://docs.gitlab.com/user/profile/personal_access_tokens/). | +| `BB_TOKEN` or `BITBUCKET_TOKEN` | A Bitbucket [personal access token](https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html). | +| `BB_TOKEN_BASIC_AUTH` or `BITBUCKET_TOKEN_BASIC_AUTH` | A Bitbucket [personal access token](https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html) with basic auth support. For clarification `user:token` has to be the value of this env. | +| `GIT_CREDENTIALS` | [URL encoded](https://en.wikipedia.org/wiki/Percent-encoding) Git username and password in the format `:`. The username and password must each be individually URL encoded, not the `:` separating them. | + +Alternatively the Git authentication can be set up via [SSH keys](/recipes/git-hosted-services/git-auth-ssh-keys). -Alternatively the Git authentication can be set up via [SSH keys](../recipes/git-hosted-services/git-auth-ssh-keys.md). +For GitHub releases, see [@semantic-release/github authentication and permissions](https://github.com/semantic-release/github#github-authentication). ### Authentication for plugins -Most **semantic-release** [plugins](plugins.md) require setting up authentication in order to publish to a package manager registry. The default [@semantic-release/npm](https://github.com/semantic-release/npm#environment-variables) and [@semantic-release/github](https://github.com/semantic-release/github#environment-variables) plugins require the following environment variables: +Most **semantic-release** [plugins](/foundation/plugins) require setting up authentication in order to publish to a package manager registry. The default [@semantic-release/npm](https://github.com/semantic-release/npm#environment-variables) and [@semantic-release/github](https://github.com/semantic-release/github#environment-variables) plugins require the following environment variables: -| Variable | Description | -| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `NPM_TOKEN` |

npm token created via npm token create.
Note: Only the auth-only level of npm two-factor authentication is supported.

| -| `GH_TOKEN` |

GitHub authentication token.
Note: Only the personal token authentication is supported.

| +| Variable | Description | +| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `NPM_TOKEN` |

npm token for publishing to npm. Trusted publishing is the recommended approach when publishing to the official registry. A token is required when publishing to alternative registries. See CI configuration recipes for setup options.

| +| `GH_TOKEN` or `GITHUB_TOKEN` |

GitHub authentication token for publishing releases. See CI configuration recipes for setup options.

| See each plugin's documentation for the environment variables required. The authentication token/credentials have to be made available in the CI service via environment variables. -See [CI configuration recipes](../recipes/ci-configurations/) for more details on how to configure environment variables in your CI service. +See [CI configuration recipes](/recipes/ci-configurations/) for examples of how to configure environment variables in your CI service. **Note**: The environment variables `GH_TOKEN`, `GITHUB_TOKEN`, `GL_TOKEN` and `GITLAB_TOKEN` can be used for both the Git authentication and the API authentication required by [@semantic-release/github](https://github.com/semantic-release/github) and [@semantic-release/gitlab](https://github.com/semantic-release/gitlab). diff --git a/src/content/docs/usage/configuration.md b/src/content/docs/usage/configuration.md index 05dac1d..f846ebc 100644 --- a/src/content/docs/usage/configuration.md +++ b/src/content/docs/usage/configuration.md @@ -2,175 +2,197 @@ title: "Configuration" --- +Configure semantic-release options, plugins, and release branches via config files, CLI arguments, or shareable configurations. + **semantic-release** configuration consists of: -- Git repository ([URL](configuration.md#repositoryurl) and options [release branches](configuration.md#branches) and [tag format](configuration.md#tagformat)) -- Plugins [declaration](configuration.md#plugins) and options -- Run mode ([debug](configuration.md#debug), [dry run](configuration.md#dryrun) and [local (no CI)](configuration.md#ci)) +- Git repository ([URL](#repositoryurl) and options [release branches](#branches) and [tag format](#tagformat)) +- Plugins [declaration](#plugins) and options +- Run mode ([debug](#debug), [dry run](#dryrun) and [local (no CI)](#ci)) -All of these options can be configured through config file, CLI arguments or by extending a [shareable configuration](shareable-configurations.md). +All of these options can be configured through config file, CLI arguments or by extending a [shareable configuration](/foundation/shareable-configurations). -Additionally, metadata of Git tags generated by **semantic-release** can be customized via standard [Git environment variables](configuration.md#git-environment-variables). +Additionally, metadata of Git tags generated by **semantic-release** can be customized via standard [Git environment variables](#git-environment-variables). ## Configuration file -**semantic-release**’s [options](configuration.md#options), mode and [plugins](plugins.md) can be set via either: +**semantic-release**’s [options](#options), mode and [plugins](/foundation/plugins) can be set via either: -- A `.releaserc` file, written in YAML or JSON, with optional extensions: `.yaml`/`.yml`/`.json`/`.js`/`.cjs`/`.mjs` -- A `release.config.(js|cjs|.mjs)` file that exports an object +- A `.releaserc` file, written in YAML or JSON, with optional extensions: `.yaml`/`.yml`/`.json`/`.js`/`.ts`/`.cjs`/`.mjs` +- A `release.config.(js|ts|cjs|mjs)` file that exports an object - A `release` key in the project's `package.json` file -Alternatively, some options can be set via CLI arguments. - -The following three examples are the same. Use main instead of master if your default branch is main. +The following three examples are the same. Use `master` instead of `main` if your default branch is `master`. - Via `release` key in the project's `package.json` file: -```json -{ - "release": { - "branches": ["master", "next"] + ```json + { + "release": { + "branches": ["main", "next"] + } } -} -``` + ``` - Via `.releaserc` file: -```json -{ - "branches": ["master", "next"] -} -``` + ```json + { + "branches": ["main", "next"] + } + ``` - Via `release.config.cjs` file: -```js -/** - * @type {import('semantic-release').GlobalConfig} - */ -module.exports = { - branches: ["master", "next"], -}; -``` + ```js + /** + * @type {import('semantic-release').GlobalConfig} + */ + module.exports = { + branches: ["main", "next"], + }; + ``` - Via `release.config.mjs` file: + ```js + /** + * @type {import('semantic-release').GlobalConfig} + */ + export default { + branches: ["main", "next"], + }; + ``` -```js -/** - * @type {import('semantic-release').GlobalConfig} - */ -export default { - branches: ["master", "next"], -}; -``` +:::note +When configuring via `package.json`, the configuration must be under the `release` property. However, when using a `.releaserc` or a `release.config.**` file, the configuration must be set without a `release` property. +::: + +## CLI arguments -- Via CLI argument: +Some [options](#options) can also be passed as command-line arguments to the `semantic-release` command. ```bash $ semantic-release --branches next ``` -**Note**: CLI arguments take precedence over options configured in the configuration file. - -**Note**: Plugin options cannot be defined via CLI arguments and must be defined in the configuration file. +:::note -**Note**: When configuring via `package.json`, the configuration must be under the `release` property. However, when using a `.releaserc` or a `release.config` file, the configuration must be set without a `release` property. +- CLI arguments take precedence over options configured in the configuration file. +- Plugin options cannot be configured through CLI arguments. See [`plugins`](#plugins) for details. + ::: ## Options -### extends +The following are **semantic-release** options you can set in the [configuration file](#configuration-file), pass as [CLI arguments](#cli-arguments), or define in a [shareable configuration](/foundation/shareable-configurations). -Type: `Array`, `String`\ -CLI arguments: `-e`, `--extends` +### `extends` -List of modules or file paths containing a [shareable configuration](shareable-configurations.md). If multiple shareable configurations are set, they will be imported in the order defined with each configuration option taking precedence over the options defined in a previous shareable configuration. +**type**: `Array`, `String`\ +**CLI arguments**: `-e`, `--extends` -**Note**: Options defined via CLI arguments or in the configuration file will take precedence over the ones defined in any shareable configuration. +List of modules or file paths containing a [shareable configuration](/foundation/shareable-configurations). If multiple shareable configurations are set, they will be imported in the order defined with each configuration option taking precedence over the options defined in a previous shareable configuration. -### branches +:::note +Options defined via CLI arguments or in the configuration file will take precedence over the ones defined in any shareable configuration. +::: -Type: `Array`, `String`, `Object`\ -Default: `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`\ -CLI arguments: `--branches` +### `branches` + +**type**: `Array`, `String`, `Object`\ +**default**: `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`\ +**CLI arguments**: `--branches` The branches on which releases should happen. By default **semantic-release** will release: -- regular releases to the default distribution channel from the branch `master` or `main` +- regular releases to the default distribution channel from the branch `main` or `master` - regular releases to a distribution channel matching the branch name from any existing branch with a name matching a maintenance release range (`N.N.x` or `N.x.x` or `N.x` with `N` being a number) - regular releases to the `next` distribution channel from the branch `next` if it exists - regular releases to the `next-major` distribution channel from the branch `next-major` if it exists - pre-releases to the `beta` distribution channel from the branch `beta` if it exists - pre-releases to the `alpha` distribution channel from the branch `alpha` if it exists -**Note**: Branches configuration key accepts [**micromatch**](https://github.com/micromatch/micromatch?tab=readme-ov-file#matching-features) globs. - -**Note**: If your repository does not have a release branch, then **semantic-release** will fail with an `ERELEASEBRANCHES` error message. If you are using the default configuration, you can fix this error by pushing a `master` or `main` branch. +:::note -**Note**: Once **semantic-release** is configured, any user with the permission to push commits on one of those branches will be able to publish a release. It is recommended to protect those branches, for example with [GitHub protected branches](https://docs.github.com/github/administering-a-repository/about-protected-branches). +- Branches configuration key accepts [**micromatch**](https://github.com/micromatch/micromatch?tab=readme-ov-file#matching-features) globs. +- If your repository does not have a release branch, then **semantic-release** will fail with an `ERELEASEBRANCHES` error message. If you are using the default configuration, you can fix this error by pushing a `main` or `master` branch. +- Once **semantic-release** is configured, any user with the permission to push commits on one of those branches will be able to publish a release. It is recommended to protect those branches, for example with [GitHub rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets). -See [Workflow configuration](workflow-configuration.md#workflow-configuration) for more details. +See [Workflow configuration](workflow-#workflow-configuration) for more details. +::: -### repositoryUrl +### `repositoryUrl` -Type: `String`\ -Default: `repository` property in `package.json` or [git origin url](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)\ -CLI arguments: `-r`, `--repository-url` +**type**: `String`\ +**default**: `repository` property in `package.json` or [git origin url](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)\ +**CLI arguments**: `-r`, `--repository-url` The git repository URL. Any valid git url format is supported (See [Git protocols](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols)). -### tagFormat +### `tagFormat` -Type: `String`\ -Default: `v${version}`\ -CLI arguments: `-t`, `--tag-format` +**type**: `String`\ +**default**: `v${version}`\ +**CLI arguments**: `-t`, `--tag-format` The [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) format used by **semantic-release** to identify releases. The tag name is generated with [Lodash template](https://lodash.com/docs#template) and will be compiled with the `version` variable. -**Note**: The `tagFormat` must contain the `version` variable exactly once and compile to a [valid Git reference](https://git-scm.com/docs/git-check-ref-format#_description). +:::note +The `tagFormat` must contain the `version` variable exactly once and compile to a [valid Git reference](https://git-scm.com/docs/git-check-ref-format#_description). +::: -### plugins +### `plugins` -Type: `Array`\ -Default: `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`\ -CLI arguments: `-p`, `--plugins` +**type**: `Array`\ +**default**: `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`\ +**CLI arguments**: `-p`, `--plugins` -Define the list of plugins to use. Plugins will run in series, in the order defined, for each [steps](../../#release-steps) if they implement it. +Define the list of plugins to use. Plugins will run in series, in the order defined, for each [release step](/foundation/release-steps/) whose lifecycle hook they implement. Plugins configuration can defined by wrapping the name and an options object in an array. -See [Plugins configuration](plugins.md#plugins) for more details. +:::note +While plugins can be listed by name via the `--plugins` CLI argument, individual plugin options cannot be configured through CLI arguments. If you need to configure plugin options beyond specifying which plugins to use, a [configuration file](#configuration-file) is required. +::: + +See [Plugins](/foundation/plugins/) for more details. -### dryRun +### `dryRun` -Type: `Boolean`\ -Default: `false` if running in a CI environment, `true` otherwise\ -CLI arguments: `-d`, `--dry-run` +**type**: `Boolean`\ +**default**: `false` if running in a CI environment, `true` otherwise\ +**CLI arguments**: `-d`, `--dry-run` -The objective of the dry-run mode is to get a preview of the pending release. Dry-run mode skips the following steps: prepare, publish, addChannel, success and fail. In addition to this it prints the next version and release notes to the console. +The objective of the dry-run mode is to get a preview of the pending release. Dry-run mode skips the following lifecycle hooks: `prepare`, `publish`, `addChannel`, `success`, and `fail`. In addition to this it prints the next version and release notes to the console. -**Note**: The Dry-run mode verifies the repository push permission, even though nothing will be pushed. The verification is done to help user to figure out potential configuration issues. +:::note +The Dry-run mode verifies the repository push permission, even though nothing will be pushed. The verification is done to help user to figure out potential configuration issues. +::: -### ci +### `ci` -Type: `Boolean`\ -Default: `true`\ -CLI arguments: `--ci` / `--no-ci` +**type**: `Boolean`\ +**default**: `true`\ +**CLI arguments**: `--ci` / `--no-ci` Set to `false` to skip Continuous Integration environment verifications. This allows for making releases from a local machine. -**Note**: The CLI arguments `--no-ci` is equivalent to `--ci false`. +:::note +The CLI arguments `--no-ci` is equivalent to `--ci false`. +::: -### debug +### `debug` -Type: `Boolean`\ -Default: `false`\ -CLI argument: `--debug` +**type**: `Boolean`\ +**default**: `false`\ +**CLI arguments**: `--debug` Output debugging information. This can also be enabled by setting the `DEBUG` environment variable to `semantic-release:*`. -**Note**: The `debug` is used only supported via CLI argument. To enable debug mode from the [JS API](../developer-guide/js-api.md#javascript-api) use `require('debug').enable('semantic-release:*')`. +:::note +The `debug` option is only supported via CLI argument. To enable debug mode from the [JS API](/developer-guide/js-api#javascript-api) use `require('debug').enable('semantic-release:*')`. +::: ## Git environment variables @@ -183,11 +205,11 @@ Output debugging information. This can also be enabled by setting the `DEBUG` en ## Existing version tags -**semantic-release** uses [Git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) to determine the commits added since the last release. If a release has been published before setting up **semantic-release** you must make sure the most recent commit included in the last published release is in the [release branches](configuration.md#branches) history and is tagged with the version released, formatted according to the [tag format](configuration.md#tagformat) configured (defaults to `vx.y.z`). +**semantic-release** uses [Git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) to determine the commits added since the last release. If a release has been published before setting up **semantic-release** you must make sure the most recent commit included in the last published release is in the history of the [release branch(es)](#branches) and is tagged with the version released, formatted according to the [tag format](#tagformat) configured (defaults to `vx.y.z`). If the previous releases were published with [`npm publish`](https://docs.npmjs.com/cli/publish) this should already be the case. -For example, if your release branch is `master`/`main`, the last release published on your project is `1.1.0` and the last commit included has the sha `1234567`, you must make sure this commit is in `master`/`main` history and is tagged with `v1.1.0`. +For example, if your release branch is `main`/`master`, the last release published on your project is `1.1.0` and the last commit included has the sha `1234567`, you must make sure this commit is in `main`/`master` history and is tagged with `v1.1.0`. ```bash # Make sure the commit 1234567 is in the release branch history diff --git a/src/content/docs/usage/getting-started.md b/src/content/docs/usage/getting-started.md deleted file mode 100644 index 0b9b97a..0000000 --- a/src/content/docs/usage/getting-started.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "Getting started" ---- - -In order to use **semantic-release** you must follow these steps: - -1. [Install](installation.md#installation) **semantic-release** in your project -2. Configure your Continuous Integration service to [run **semantic-release**](ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded) -3. Configure your Git repository and package manager repository [authentication](ci-configuration.md#authentication) in your Continuous Integration service -4. Configure **semantic-release** [options and plugins](configuration.md#configuration) diff --git a/src/content/docs/usage/getting-started.mdx b/src/content/docs/usage/getting-started.mdx new file mode 100644 index 0000000..b64da75 --- /dev/null +++ b/src/content/docs/usage/getting-started.mdx @@ -0,0 +1,18 @@ +--- +title: "Getting started" +--- + +import { Steps } from "@astrojs/starlight/components"; + +In order to use **semantic-release** you must follow these steps: + + + +1. Configure **semantic-release** [options and plugins](/usage/configuration) +2. Configure your Continuous Integration service by following [CI configuration](/usage/ci-configuration) + - Choose the guide for your CI service in [Choose your CI service](/usage/ci-configuration#choose-your-ci-service) + - Ensure **semantic-release** runs only after all tests succeed in [Run semantic-release only after all tests succeeded](/usage/ci-configuration#run-semantic-release-only-after-all-tests-succeeded) + - Configure Git and package manager authentication in [Authentication](/usage/ci-configuration#authentication) +3. [Run **semantic-release**](/usage/running) in your CI pipeline + + diff --git a/src/content/docs/usage/plugins.md b/src/content/docs/usage/plugins.md deleted file mode 100644 index 0c9d133..0000000 --- a/src/content/docs/usage/plugins.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: "Plugins" ---- - -Each [release step](../../#release-steps) is implemented by configurable plugins. This allows for support of different [commit message formats](../../#commit-message-format), release note generators and publishing platforms. - -A plugin is a npm module that can implement one or more of the following steps: - -| Step | Required | Description | -| ------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `verifyConditions` | No | Responsible for verifying conditions necessary to proceed with the release: configuration is correct, authentication token are valid, etc... | -| `analyzeCommits` | Yes | Responsible for determining the type of the next release (`major`, `minor` or `patch`). If multiple plugins with a `analyzeCommits` step are defined, the release type will be the highest one among plugins output. | -| `verifyRelease` | No | Responsible for verifying the parameters (version, type, dist-tag etc...) of the release that is about to be published. | -| `generateNotes` | No | Responsible for generating the content of the release note. If multiple plugins with a `generateNotes` step are defined, the release notes will be the result of the concatenation of each plugin output. | -| `prepare` | No | Responsible for preparing the release, for example creating or updating files such as `package.json`, `CHANGELOG.md`, documentation or compiled assets and pushing a commit. | -| `publish` | No | Responsible for publishing the release. | -| `addChannel` | No | Responsible for adding a release channel (e.g. adding an npm dist-tag to a release). | -| `success` | No | Responsible for notifying of a new release. | -| `fail` | No | Responsible for notifying of a failed release. | - -Release steps will run in that order. At each step, **semantic-release** will run every plugin in the [`plugins` array](plugins.md#plugins-declaration-and-execution-order), as long as the plugin implements the step. - -**Note:** If no plugin with a `analyzeCommits` step is defined `@semantic-release/commit-analyzer` will be used. - -## Plugins installation - -### Default plugins - -These four plugins are already part of **semantic-release** and are listed in order of execution. They do not have to be installed separately: - -``` -"@semantic-release/commit-analyzer" -"@semantic-release/release-notes-generator" -"@semantic-release/npm" -"@semantic-release/github" -``` - -### Additional plugins - -[Additional plugins](../extending/plugins-list.md) have to be installed via npm: - -```bash -$ npm install @semantic-release/git @semantic-release/changelog -D -``` - -## Plugins declaration and execution order - -Each plugin must be configured with the [`plugins` options](configuration.md#plugins) by specifying the list of plugins by npm module name. - -```json -{ - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/npm" - ] -} -``` - -**Note:** If the `plugins` option is defined, it overrides the default plugin list, rather than merging with it. - -For each [release step](../../#release-steps) the plugins that implement that step will be executed in the order in which they are defined. - -```json -{ - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/npm", - "@semantic-release/git" - ] -} -``` - -With this configuration **semantic-release** will: - -- execute the `verifyConditions` implementation of `@semantic-release/npm` then `@semantic-release/git` -- execute the `analyzeCommits` implementation of `@semantic-release/commit-analyzer` -- execute the `generateNotes` implementation of `@semantic-release/release-notes-generator` -- execute the `prepare` implementation of `@semantic-release/npm` then `@semantic-release/git` -- execute the `publish` implementation of `@semantic-release/npm` - -Order is first determined by release steps (such as `verifyConditions` → `analyzeCommits`). At each release step, plugins are executed in the order in which they are defined. - -## Plugin options configuration - -A plugin configuration can be specified by wrapping the name and an options object in an array. Options configured this way will be passed only to that specific plugin. - -Global plugin configuration can be defined at the root of the **semantic-release** configuration object. Options configured this way will be passed to all plugins. - -```json -{ - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - [ - "@semantic-release/github", - { - "assets": ["dist/**"] - } - ], - "@semantic-release/git" - ], - "preset": "angular" -} -``` - -With this configuration: - -- All plugins will receive the `preset` option, which will be used by both `@semantic-release/commit-analyzer` and `@semantic-release/release-notes-generator` (and ignored by `@semantic-release/github` and `@semantic-release/git`) -- The `@semantic-release/github` plugin will receive the `assets` options (`@semantic-release/git` will not receive it and therefore will use it's default value for that option) diff --git a/src/content/docs/usage/installation.md b/src/content/docs/usage/running.md similarity index 53% rename from src/content/docs/usage/installation.md rename to src/content/docs/usage/running.md index cce3fea..5e8477b 100644 --- a/src/content/docs/usage/installation.md +++ b/src/content/docs/usage/running.md @@ -1,16 +1,18 @@ --- -title: "Installation" +title: "Running semantic-release" --- -## Global installation +How to run **semantic-release** in your CI pipeline using `npx`, including version pinning strategies and tradeoffs of local installation. -We recommend installing **semantic-release** directly in the CI environment as part of executing with [npx](../support/FAQ.md#what-is-npx): +## Using npx (recommended) + +We recommend running **semantic-release** directly in the CI environment with [npx](/support/faq#what-is-npx): ```sh npx semantic-release ``` -If you need to leverage plugins and/or presets that are not included in the base **semantic-release** package, you can install them part of executing with `npx` as well: +If you need to leverage plugins and/or presets that are not included in the base **semantic-release** package, you can include them as part of your `npx` command as well: ```sh npx --package semantic-release --package @semantic-release/exec --package conventional-changelog-conventionalcommits semantic-release @@ -18,7 +20,7 @@ npx --package semantic-release --package @semantic-release/exec --package conven ### Notes -1. When globally installing **semantic-release** as part of running with `npx`, we recommend setting at least the major **semantic-release** version to install. For example, by using `npx semantic-release@25`. This way you control which major version of **semantic-release** is used by your pipeline, and thus avoid breaking the release when there's a new major version of **semantic-release**. +1. When running **semantic-release** with `npx`, we recommend setting at least the major version. For example, by using `npx semantic-release@25`. This way you control which major version of **semantic-release** is used by your pipeline, and thus avoid breaking the release when there's a new major version of **semantic-release**. 2. Pinning **semantic-release** to an exact version makes your releases even more deterministic. But pinning also means you, or a bot, must upgrade **semantic-release** when a new version is released. 3. You can use [Renovate's regex manager](https://docs.renovatebot.com/modules/manager/regex/) to get automatic updates for **semantic-release** in either of the above scenarios. Put this in your Renovate configuration file: @@ -39,12 +41,18 @@ npx --package semantic-release --package @semantic-release/exec --package conven } ``` -4. `npx` is a tool bundled with `npm@>=5.2.0`. You can use it to install (and run) the **semantic-release** binary. See [What is npx](../support/FAQ.md#what-is-npx) for more details. +4. `npx` is a tool bundled with `npm@>=5.2.0`. You can use it to download and run the **semantic-release** binary in a single step. See [What is npx](/support/faq#what-is-npx) for more details. -## Local installation +## Local installation (not recommended) -Since **semantic-release** isn't truly a development dependency, but rather a release dependency, we recommend avoiding installation as a local dependency of your project. Instead, we recommend installing it globally in your CI environment as part of executing with [npx](../support/FAQ.md#what-is-npx) as described [above](installation.md#global-insallation). Installing only during the release process avoids: +Since **semantic-release** isn't truly a development dependency, but rather a release dependency, we recommend against installing it as a local dependency of your project. Instead, we recommend running it in your CI environment with [npx](/support/faq#what-is-npx) as described [above](#using-npx-recommended). Running only during the release process avoids: - installing unnecessary dependencies during development and testing, including the fairly sizable dependency on **npm** - installing a different version of **npm** into `node_modules/` than the one used to run the release, which can lead to conflicts and unexpected behavior - installing dependencies that could conflict with other development dependencies, like **commitlint** + +:::note +A tradeoff of running via `npx` instead of installing locally is that the full **semantic-release** dependency graph is not pinned by your project's lockfile. + +The [version pinning strategies](#notes) above help mitigate this. +::: diff --git a/src/content/docs/usage/shareable-configurations.md b/src/content/docs/usage/shareable-configurations.md deleted file mode 100644 index 6fa08a3..0000000 --- a/src/content/docs/usage/shareable-configurations.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Shareable configurations" ---- - -A shareable configuration is an [npm](https://www.npmjs.com/) package that exports a **semantic-release** configuration object. It allows for use of the same configuration across several projects. - -The shareable configurations to use can be set with the [extends](configuration.md#extends) option. - -See [shareable configurations list](../extending/shareable-configurations-list.md). diff --git a/src/styles/global.css b/src/styles/global.css index 86fac07..f550209 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -60,6 +60,7 @@ article.card, .dialog-frame, .pagefind-ui__search-input, dialog-frame, +.sl-link-card, .page-context-action__compact-copy-btn, .page-context-action__compact-scroll-top-btn, .page-context-action__compact-kebab-btn, @@ -82,3 +83,17 @@ dialog-frame, width: var(--sl-sidebar-width); } } + +/* Plugin card grid */ +.plugin-grid { + display: grid; + grid-template-columns: 1fr; + gap: 1rem; + margin-top: 1rem; +} + +@media (min-width: 40rem) { + .plugin-grid { + grid-template-columns: repeat(2, 1fr); + } +}