npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@alexbabel/semantic-release-docker

v2.9.0

Published

Set of semantic-release plugins to publish to gitlab docker registry

Downloads

437

Readme

@alexbabel/semantic-release-docker

What is different in comparison to the upstream project?

This plugin also takes care of building the image. Therefore your ci file is much more simplified.

npm version npm downloads semantic-release

Set of semantic-release plugins for publishing a docker image to GitLab Container Registry.

{
  "release": {
    "verifyConditions": "@alexbabel/semantic-release-docker",
    "prepare": {
      "path": "@alexbabel/semantic-release-docker",
      "buildArgs": [
        "--build-arg",
        "VARIABLE"
      ]
    },
    "publish": "@alexbabel/semantic-release-docker"
  }
}

How to build for multiple platforms

{
  "release": {
    "verifyConditions": "@alexbabel/semantic-release-docker",
    "prepare": {
      "path": "@alexbabel/semantic-release-docker",
      "buildArgs": [
        "--platform",
        "linux/amd64,linux/arm/v7,linux/arm64",
        "--push"
      ]
    },
    "publish": {
      "path": "@alexbabel/semantic-release-docker",
      "skipPublish": true
    }
  }
}

Configuration

Environment variables: | Variable | Description | Default | | --- | --- | --- | | CI_REGISTRY | The registry to push to | ghcr.io | | CI_REGISTRY_IMAGE | The name of the image including the registry domain | $CI_REGISTRY/$GITHUB_REPOSITORY | | CI_REGISTRY_USER | The user to use to authenticate against the registry | $GITHUB_ACTOR (fallback: AlexanderBabel) | | CI_REGISTRY_PASSWORD | The password for the specified user | |

Plugins

verifyConditions

Verify that all needed configuration is present and login to the GitLab Container Registry.

prepare

Build the docker image. You can pass additional build arguments if needed.

publish

Tag the image with the new version, push it to GitLab Container Registry and update the latest tag.

Multi Platform builds: Can be skipped by using "skipPublish": true in the semantic release configuration. When using buildx you'll need to use the --push argument (Reason).

Example .gitlab-ci.yml

stages:
  - test
  - release

test:
  image: node:alpine
  stage: test
  before_script:
    - npm i
  script:
    - npm t

release:
  image: node:alpine
  stage: release
  before_script:
    - npm i
  script:
    - npx semantic-release
  only:
    - master

Example GitHub workflow file

name: Release a new version
on:
  push:
    branches:
      - main
      - development

jobs:
  release:
    if: |
      !(github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]')) &&
      !(github.event_name == 'pull_request' && contains(join(github.event.pull_request.title, github.event.pull_request.body), '[skip ci]'))
    runs-on: ubuntu-latest
    steps:
      - name: Clone code repo
        uses: actions/checkout@v2

      # Required for multi platform builds
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1

      # Required for multi platform builds
      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v1
        with:
          install: true

      # Useful if you want to use signed commits
      - name: Import GPG key
        uses: crazy-max/ghaction-import-gpg@v2
        with:
          git_user_signingkey: true
          git_commit_gpgsign: true
        env:
          GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
          PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

      - name: Install dependencies
        run: yarn

      - name: Semantic release
        run: yarn semantic-release
        env:
          # This only works if you give access the project access to the package.
          # More information: https://docs.github.com/en/actions/guides/publishing-docker-images#publishing-images-to-github-packages
          CI_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

          GIT_AUTHOR_NAME: ${{ secrets.GIT_USERNAME }}
          GIT_AUTHOR_EMAIL: ${{ secrets.GIT_EMAIL }}
          GIT_COMMITTER_NAME: ${{ secrets.GIT_USERNAME }}
          GIT_COMMITTER_EMAIL: ${{ secrets.GIT_EMAIL }}