Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@semantic-release-plus/docker

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@semantic-release-plus/docker

semantic-release plugin to release a docker container

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
929
increased by33.29%
Maintainers
1
Weekly downloads
 
Created
Source

@semantic-release-plus/docker

npm downloads code style: prettier semantic-release-plus license

A semantic-release-plus or semantic-release plugin for publishing a docker images to a docker registry.

StepDescription
verifyConditionsVerify that all needed configuration and DOCKER_USERNAME and DOCKER_PASSWORD environment variables are present and logs into the Docker registry unless skipped.
addChannelTag 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.
publishTag the image specified by name as {registry}/{name}:{version} and {registry}/{name}:{channel} (based on configuration) and push it to the Docker registry.

Install

$ npm install @semantic-release/npm -D

Usage

The plugin can be configured in the semantic-release-plus configuration file:

{
  "release": {
    "plugins": [
      [
        "@semantic-release-plus/docker",
        {
          "name": "my-cool-docker-app"
        }
      ]
    ]
  }
}

Configuration

OptionDescriptionTypeDefault
nameRequired config associated with the tag name assigned to the image during build docker build -t name.string
registryThe docker registry to login and push images to, this will be pre-pended to the name field when taggingstringdocker.io
publishChannelTagWill 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 releasesbooleantrue
skipLoginSkips 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 variablesbooleanfalse

Example github action publishing to ghcr.io

The following is an example github action configuration, the source repo can be found at https://github.com/JoA-MoS/srp-docker-example

name: CI

on:
  push:
    branches:
      - master
      - next
      - beta
      - alpha
      - '*.x'
  pull_request:
    types:
      - opened
      - synchronize

jobs:
  build_release:
    runs-on: ubuntu-latest
    steps:
      - name: Build
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - run: docker build --tag joa-mos/srp-docker-example .
      - name: Release
        uses: actions/setup-node@v2
        with:
          cache: npm
      - run: npm ci
      - run: npx semantic-release-plus
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DOCKER_USERNAME: joa-mos
          DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

Example .travis.yml

jobs:
  include:
    - stage: release
      language: node_js
      node_js: '8'
      services:
        - docker
      script:
        - docker build -t username/imagename .
        - npm run semantic-release

stages:
  - test
  - name: release
    if: branch = master AND type = push AND fork = false

branches:
  except:
    - /^v\d+\.\d+\.\d+$/

Circle CI Example .config.yml

version: 2
jobs:
  release:
    docker:
      - image: circleci/node:8
    steps:
      - setup_remote_docker:
          docker_layer_caching: true
      - run:
          name: release
          command: |
            docker build -t username/imagename .
            npm run semantic-release

workflows:
  version: 2
  pipeline:
    jobs:
      - test
      - release:
          requires:
            - test
          filters:
            branches:
              only: master

Note that setup_remote_docker step is required for this plugin to work in Circle CI environment

How to keep new version in package.json inside docker image?

It 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.

FAQs

Package last updated on 21 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc