{"id":18816021,"url":"https://github.com/0-vortex/semantic-release-docker-mini","last_synced_at":"2026-01-14T06:30:17.238Z","repository":{"id":143907991,"uuid":"432296669","full_name":"0-vortex/semantic-release-docker-mini","owner":"0-vortex","description":"Opinionated fork of @semantic-release-plus/docker with minimal features","archived":false,"fork":false,"pushed_at":"2021-12-01T17:27:52.000Z","size":926,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-30T18:49:03.013Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0-vortex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-26T20:43:24.000Z","updated_at":"2021-12-01T17:27:53.000Z","dependencies_parsed_at":"2023-03-22T11:32:47.604Z","dependency_job_id":null,"html_url":"https://github.com/0-vortex/semantic-release-docker-mini","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0-vortex%2Fsemantic-release-docker-mini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0-vortex%2Fsemantic-release-docker-mini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0-vortex%2Fsemantic-release-docker-mini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0-vortex%2Fsemantic-release-docker-mini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0-vortex","download_url":"https://codeload.github.com/0-vortex/semantic-release-docker-mini/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239753703,"owners_count":19691160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T23:51:51.411Z","updated_at":"2026-01-14T06:30:17.194Z","avatar_url":"https://github.com/0-vortex.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# semantic-release-docker-mini\n\n[![npm](https://img.shields.io/npm/v/semantic-release-docker-mini.svg)](https://www.npmjs.com/package/semantic-release-docker-mini)\n[![downloads](https://img.shields.io/npm/dt/semantic-release-docker-mini.svg)](https://www.npmjs.com/package/semantic-release-docker-mini)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![semantic-release-plus](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release--plus-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![license](https://img.shields.io/npm/l/semantic-release-docker-mini.svg)](https://github.com/semantic-release-plus/semantic-release-plus/blob/beta/packages/plugins/docker/LICENSE)\n\nA [semantic-release-plus](https://github.com/semantic-release-plus/semantic-release) or [semantic-release](https://github.com/semantic-release/semantic-release) plugin for publishing a docker images to a docker registry.\n\n| Step               | Description                                                                                                                                                               |\n| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `verifyConditions` | Verify that all needed configuration and `DOCKER_USERNAME` and `DOCKER_PASSWORD` environment variables are present and logs into the Docker registry unless skipped.      |\n| `addChannel`       | Tag an existing image with a new channel. _Run only if there are releases that have been merged from a higher branch but not added on the channel of the current branch._ |\n| `publish`          | Tag the image specified by `name` as `{registry}/{name}:{version}` and `{registry}/{name}:{channel}` (based on configuration) and push it to the Docker registry.         |\n\n## Install\n\n```bash\nnpm install semantic-release-docker-mini -D\n```\n\n## Usage\n\n1. Build your docker image and tag it with a known name that does not include a registry.\n2. Configure the plugin with the same name and specify the registry, if publishing to a registry other than docker.io. The registry to publish can either be defined in the `name` property, the `registry` property or the `name.registry` property.\n\nThe plugin can be configured in the [**semantic-release-plus** configuration file](https://github.com/semantic-release-plus/semantic-release/blob/master/docs/usage/configuration.md#configuration):\n\n## Configuration\n\n| Option              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                      | Type             | Default   |\n| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------- | --------- |\n| **`name`**          | Required config associated with the tag name assigned to the image during build `docker build -t name`. This can include registry, namespace, repo, and suffix (either tag or sha) in the following format `\u003cregistry\u003e/\u003cnamespace\u003e/\u003crepo\u003e:\u003ctag\u003e` or `\u003cregistry\u003e/\u003cnamespace\u003e/\u003crepo\u003e@\u003csha\u003e`. If a registry is defined as part of the name it will override the registry option. This can also be provided as an object, see example for interface. | `string\\|object` |           |\n| `registry`          | The docker registry to login and push images to, this will be pre-pended to the name field when tagging                                                                                                                                                                                                                                                                                                                                          | `string`         | docker.io |\n| `publishChannelTag` | Will publish a channel (dist) tag such as `latest`, `next`, `beta`, `alpha`, `1`, and `1.1`, that always points to the most recent release on the channel. `1`, `1.1` tags will only be created on maintenance branches. See [Publishing maintenance releases](https://github.com/semantic-release-plus/semantic-release/blob/master/docs/recipes/maintenance-releases.md)                                                                       | `boolean`        | true      |\n| `skipLogin`         | Skips logging in to docker hub in the verifyConditions step, used if you log in separately in your CI job. Removes requirement for `DOCKER_USERNAME` and `DOCKER_PASSWORD` environment variables                                                                                                                                                                                                                                                 | `boolean`        | false     |\n\n### Name\n\nThe name field is required and can be either a string or an object, if a string it will be converted into an object using this syntax `\u003cregistry\u003e/\u003cnamespace\u003e/\u003crepo\u003e:\u003ctag\u003e` or `\u003cregistry\u003e/\u003cnamespace\u003e/\u003crepo\u003e@\u003csha\u003e`.\n\n| Property         | Description                                                                            | Type     | Default     |\n| ---------------- | -------------------------------------------------------------------------------------- | -------- | ----------- |\n| `registry`       | the registry that the images will be published to / pulled from when adding to channel | `string` | `undefined` |\n| `namespace`      | often your username but can also be an organization name                               | `string` | `undefined` |\n| **`repository`** | the repository of the image                                                            | `string` |             |\n| `tag`            | the string following the `:` after the repo                                            | `string` | `undefined` |\n| `repository`     | the sha value following the `@` after the repo                                         | `string` | `undefined` |\n\n```jsonc\n{\n  \"name\": {\n    \"registry\": \"string\", // optional\n    \"namespace\": \"string\", // optional\n    \"repository\": \"string\", // required\n    \"tag\": \"string\", // optional\n    \"sha\": \"string\" // optional\n  }\n}\n```\n\n### Example Configurations\n\nConsider the image was built and tagged with the following command. The following configurations will result in the same behavior.\n\n```bash\ndocker build -t `my-namespace/my-repo:my-tag` .\n```\n\n```json\n{\n  \"release\": {\n    \"plugins\": [\n      [\n        \"semantic-release-docker-mini\",\n        {\n          \"name\": \"ghcr.io/my-namespace/my-repo:my-tag\"\n        }\n      ]\n    ]\n  }\n}\n```\n\n```json\n{\n  \"release\": {\n    \"plugins\": [\n      [\n        \"semantic-release-docker-mini\",\n        {\n          \"name\": \"my-namespace/my-repo:my-tag\",\n          \"registry\": \"ghcr.io\"\n        }\n      ]\n    ]\n  }\n}\n```\n\n```json\n{\n  \"release\": {\n    \"plugins\": [\n      [\n        \"semantic-release-docker-mini\",\n        {\n          \"name\": {\n            \"registry\": \"ghcr.io\",\n            \"namespace\": \"my-namespace\",\n            \"repository\": \"my-repo\",\n            \"tag\": \"my-tag\"\n          }\n        }\n      ]\n    ]\n  }\n}\n```\n\nThe docker commands that will be run with this config are the following when releasing version 1.2.3\n\n```bash\ndocker tag my-namespace/my-repo:my-tag ghcr.io/my-namespace/my-repo:1.2.3\ndocker tag my-namespace/my-repo:my-tag ghcr.io/my-namespace/my-repo:latest\ndocker push ghcr.io/my-namespace/my-repo:1.2.3\ndocker push ghcr.io/my-namespace/my-repo:latest\n```\n\nIn the situation where you are adding an existing build to a channel it will pull the existing build from the registry and tag it with the new channel. With the above config and adding build 1.2.4. from the next channel to the latest channel it will run the following commands.\n\n```bash\ndocker pull ghcr.io/my-namespace/my-repo:1.2.4\ndocker tag ghcr.io/my-namespace/my-repo:1.2.4 ghcr.io/my-namespace/my-repo:latest\ndocker push ghcr.io/my-namespace/my-repo:latest\n```\n\n## Example github action publishing to ghcr.io\n\nThe following is an example github action configuration, the source repo can be found at https://github.com/JoA-MoS/srp-docker-example\n\n```yml\nname: CI\n\non:\n  push:\n    branches:\n      - master\n      - next\n      - beta\n      - alpha\n      - '*.x'\n  pull_request:\n    types:\n      - opened\n      - synchronize\n\njobs:\n  build_release:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Build\n        uses: actions/checkout@v2\n        with:\n          fetch-depth: 0\n      - run: docker build --tag joa-mos/srp-docker-example .\n      - name: Release\n        uses: actions/setup-node@v2\n        with:\n          cache: npm\n      - run: npm ci\n      - run: npx semantic-release-plus\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          DOCKER_USERNAME: joa-mos\n          DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}\n```\n\n## Example .travis.yml\n\n```yml\njobs:\n  include:\n    - stage: release\n      language: node_js\n      node_js: '8'\n      services:\n        - docker\n      script:\n        - docker build -t namespace/repository .\n        - npm run semantic-release-plus\n\nstages:\n  - test\n  - name: release\n    if: branch = master AND type = push AND fork = false\n\nbranches:\n  except:\n    - /^v\\d+\\.\\d+\\.\\d+$/\n```\n\n## Circle CI Example .config.yml\n\n```yml\nversion: 2\njobs:\n  release:\n    docker:\n      - image: circleci/node:8\n    steps:\n      - setup_remote_docker:\n          docker_layer_caching: true\n      - run:\n          name: release\n          command: |\n            docker build -t namespace/repository .\n            npm run semantic-release-plus\n\nworkflows:\n  version: 2\n  pipeline:\n    jobs:\n      - test\n      - release:\n          requires:\n            - test\n          filters:\n            branches:\n              only: master\n```\n\n\u003e Note that `setup_remote_docker` step is required for this plugin to work in Circle CI environment\n\n## How to keep new version in package.json inside docker image?\n\nIt is best to let semantic-release focus on releasing your built artifact and not extend semantic-release to also do the build. I recommend using semantic-release-plus to get the next version without creating a tag then using that durning your build process. An example of this can be found in the semantic-release-plus [Expected next version recipe](https://github.com/semantic-release-plus/semantic-release/blob/20b0c4420e5466a7d7ed16fb3fe4981609173187/docs/recipes/expected-next-version.md#L1).\n\n## Publishing to multiple registries\n\nYou should be able to publish to multiple registries by adding the docker plugin multiple times with different registry configurations. You will need to login to the registries outside of the plugin and configure the plugin to skip login (unless you happen to have the same username and password between different registries)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0-vortex%2Fsemantic-release-docker-mini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0-vortex%2Fsemantic-release-docker-mini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0-vortex%2Fsemantic-release-docker-mini/lists"}