Skip to content

rcwbr/release-it-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

release-it-docker

Docker image wrappers for release-it

Usage

Base image usage

The base image includes the release-it tool only. To use the image:

docker run -it ghcr.io/rcwbr/release-it-docker:0.7.0

The container entrypoint is the release-it CLI executable.

Conventional-changelog image usage

The conventional-changelog image includes the conventional-changelog release-it plugin. To use the image:

docker run -it ghcr.io/rcwbr/release-it-docker-conventional-changelog:0.7.0

File bumper image usage

The file-bumper image includes the bumper release-it plugin. To use the image:

docker run -it ghcr.io/rcwbr/release-it-docker-file-bumper:0.7.0

If using the default configuration, it is configured to bump versions in a plaintext VERSION file in the repository root, as well as any references to the version in the README.md file. By default, it will replace the entire contents of the file with the version number.

⚠️ Unlike the other images, the bumper release-it default configuration sets git.commit true (as the version bump changes must be committed). This results in a commit for the release on the default branch.

File bumper tag-only config usage

To support avoiding the above-mentioned behavior including a commit to the default branch, the file-bumper image includes a configuration file that directs release-it to apply the push the commit only as the release tag, not to any branch. It sets git.pushArgs to ["tags"] so as to push the tag only and not commit to the default branch. It also configures git.getLatestTagFromAllRefs true so that the latest tag may still be discovered despite not being associated with a commit on the default branch.

⚠️ This configuration outputs only to the VERSION file, not README.md, and replaces the entire file contents (vs. just the version pattern).

To use this configuration option, specify the config file path as /.tag-only-release-it.json. For example:

docker run -it ghcr.io/rcwbr/release-it-docker-file-bumper:0.7.0 --config /.tag-only-release-it.json

Or using the release-it-gh-workflow:

jobs:
  release-it-workflow:
    uses: rcwbr/release-it-gh-workflow/.github/workflows/[email protected]
    with:
      release-it-config: /.tag-only-release-it.json

Default configurations

Both the base and conventional-changelog images provide a default release-it configuration, located at /.release-it.json. To use this config, provide an arg to release-it:

docker run -it ghcr.io/rcwbr/release-it-docker:0.7.0 --config /.release-it.json

GitHub workflow usage

The recommended approach to apply this image in a GitHub workflow is via the reusable release-it-gh-workflow.

Contributing

Release-it config file layering

The .release-it.json configuration files in the image subdirectories are merged using jq, such that the content of each JSON file represents only the delta to that of the base image. This combination logic is expressed within each image's Dockerfile.

Build

The recommended method to build the image is using Docker Bake and the Dockerfile partials GitHub cache bake file. The steps to build the image using this method are as follows.

Prepare a Docker builder with the docker-container driver:

docker builder create --use --bootstrap --driver docker-container

Authenticate to GitHub container registry (see instructions):

echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin

Build base image

Build the image:

cd base
REGISTRY=ghcr.io/rcwbr/ IMAGE_NAME=release-it-docker docker buildx bake --file github-cache-bake.hcl 'https://github.com/rcwbr/dockerfile-partials.git#main'

Build conventional-changelog image

cd conventional-changelog
REGISTRY=ghcr.io/rcwbr/ IMAGE_NAME=release-it-docker-conventional-changelog docker buildx bake --file github-cache-bake.hcl --file cwd://docker-bake.hcl 'https://github.com/rcwbr/dockerfile-partials.git#main'

CI/CD

This repo uses the release-it-gh-workflow, with the conventional-changelog image defined at any given ref, as its automation.

Settings

The GitHub repo settings for this repo are defined as code using the Probot settings GitHub App. Settings values are defined in the .github/settings.yml file. Enabling automation of settings via this file requires installing the app.

The settings applied are as recommended in the release-it-gh-workflow usage, including tag and branch protections, GitHub App and environment authentication, and required checks.