diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..d23fbbc --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,19 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'weekly' + labels: + - 'github-actions' + - package-ecosystem: 'docker' + directory: '/' + schedule: + interval: 'weekly' + labels: + - 'docker' diff --git a/.github/workflows/publish-container.yml b/.github/workflows/publish-container.yml index bb2dec8..5af840d 100644 --- a/.github/workflows/publish-container.yml +++ b/.github/workflows/publish-container.yml @@ -11,6 +11,7 @@ on: # required: false # default: true # type: boolean + pull_request: {} jobs: push_to_registry: @@ -18,9 +19,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install dependencies @@ -35,20 +36,20 @@ jobs: if: "${{ steps.getversion.outputs.version != '' }}" run: echo ${{ steps.getversion.outputs.version }} - name: Log in to Docker Hub - uses: docker/login-action@v2 - if: "${{ steps.getversion.outputs.version != '' }}" + uses: docker/login-action@v3 + if: "${{ steps.getversion.outputs.version != '' && github.event_name != 'pull_request' }}" with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 if: "${{ steps.getversion.outputs.version != '' }}" with: context: . - push: true + push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} build-args: | CZ_VERSION=${{ steps.getversion.outputs.version }} tags: | - commitizen/commitizen:2 + commitizen/commitizen:4 commitizen/commitizen:latest commitizen/commitizen:${{ steps.getversion.outputs.version }} diff --git a/Dockerfile b/Dockerfile index 565cb76..806dd3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,17 @@ FROM python:3-alpine +LABEL org.opencontainers.image.source="https://github.com/commitizen-tools/commitizen" +LABEL org.opencontainers.image.description="Commitizen is release management tool designed for teams" + WORKDIR /app # Add dependencies RUN apk add --update -t --no-cache git curl alpine-sdk RUN ["pip", "install", "-U", "--no-cache-dir", "pip"] -ARG CZ_VERSION=2.28.0 +ARG CZ_VERSION=4.1.1 RUN pip install --no-cache-dir commitizen==$CZ_VERSION -CMD [ "cz", "version" ] +ENTRYPOINT ["cz"] + +CMD [ "version" ] diff --git a/README.md b/README.md index 5e6c0c6..5d0cde3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # commitizen-docker-image -> commitizen now avaialble in docker 💪 +> commitizen now available in docker 💪 ![Docker Pulls](https://img.shields.io/docker/pulls/commitizen/commitizen?style=flat-square) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/commitizen/commitizen/latest?style=flat-square) @@ -8,23 +8,49 @@ ## Docker images -We publish major versions starting with `v2` + latest exact v2. +We publish major versions starting with `v4` + latest exact v4. | Tag | Description | | ------------------------------ | --------------------------------------------------------------- | -| `commitizen/commitizen:latest` | Latest major version, at the moment v2 | +| `commitizen/commitizen:latest` | Latest major version, at the moment v4 | +| `commitizen/commitizen:4` | Points to latest v4 | +| `commitizen/commitizen:4.x` | See [tags](https://hub.docker.com/r/commitizen/commitizen/tags) | +| `commitizen/commitizen:3` | Points to latest v3 | +| `commitizen/commitizen:3.x` | See [tags](https://hub.docker.com/r/commitizen/commitizen/tags) | | `commitizen/commitizen:2` | Points to latest v2 | | `commitizen/commitizen:2.x` | See [tags](https://hub.docker.com/r/commitizen/commitizen/tags) | This repo checks daily for the latest version and tries to publish it. +## Migrating to `v4` + +Nothing has changed, python 3.8 support has been dropped. + +## Migrating from `v2` to `v3` image + +We've moved this images from using `CMD` to `ENTRYPOINT` for `v3`. + +Where you were doing this: + +```sh +docker run --rm --name commitizen registry.hub.docker.com/commitizen/commitizen:2 /bin/sh -c "cz ls" +``` + +Now you only need to do: + +```sh +docker run --rm --name commitizen registry.hub.docker.com/commitizen/commitizen:3 ls +``` ## Usage ## As Script ```bash -docker run --rm -v $(pwd):/app commitizen/commitizen:latest /bin/sh -c 'cz bump --changelog' +docker run --rm \ + -v $(pwd):/app \ + commitizen/commitizen:latest \ + bump --changelog ``` ## Inside container @@ -33,7 +59,10 @@ Open a terminal inside docker with `cz` available and with the current directory This way we can run any `cz` command. ```bash -docker run --rm -it -v $(pwd):/app commitizen/commitizen:latest +docker run --rm -it \ + --entrypoint /bin/sh \ + -v $(pwd):/app \ + commitizen/commitizen:latest ``` ## Contributing @@ -49,5 +78,5 @@ docker run --rm -it -v $(pwd):/app commitizen/commitizen:latest ```bash ./scripts/build -./scripts/run 'cz ls' +./scripts/cz ls ``` diff --git a/scripts/auto_publish/compare-versions b/scripts/auto_publish/compare-versions index f9391af..5633a7e 100755 --- a/scripts/auto_publish/compare-versions +++ b/scripts/auto_publish/compare-versions @@ -26,5 +26,5 @@ else echo 'Creating file: `VERSION`' echo "$PIP_LATEST" > VERSION echo "Setting variable 'version'" - echo "::set-output name=version::$PIP_LATEST" + echo "version=$PIP_LATEST" >> "$GITHUB_OUTPUT" fi diff --git a/scripts/build b/scripts/build index d248970..ee7983f 100755 --- a/scripts/build +++ b/scripts/build @@ -1,11 +1,11 @@ #!/bin/sh -e set -x -EXACT_VERSION="${EXACT_VERSION:-2}" +EXACT_VERSION="${EXACT_VERSION:-3}" -# Also tag exact question, if not provided we repeat value '2' twice, but +# Also tag exact question, if not provided we repeat value '3' twice, but # it won't create any problem docker build \ - -t registry.hub.docker.com/commitizen/commitizen:2 \ + -t registry.hub.docker.com/commitizen/commitizen:4 \ -t registry.hub.docker.com/commitizen/commitizen:latest \ -t "registry.hub.docker.com/commitizen/commitizen:$EXACT_VERSION" \ . \ No newline at end of file diff --git a/scripts/run b/scripts/cz similarity index 69% rename from scripts/run rename to scripts/cz index 862f37d..65d7cb2 100755 --- a/scripts/run +++ b/scripts/cz @@ -1,2 +1,2 @@ #!/bin/sh -ex -docker run --rm --name commitizen registry.hub.docker.com/commitizen/commitizen:2 /bin/sh -c "$@" +docker run --rm --name commitizen registry.hub.docker.com/commitizen/commitizen:4 "$@"