Publish Docker image #439
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker image | |
on: | |
schedule: | |
# At the end of every day | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
# inputs: | |
# run: | |
# description: 'Dummy button' | |
# required: false | |
# default: true | |
# type: boolean | |
pull_request: {} | |
jobs: | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
sudo apt-get install wget grep jq | |
- name: Compare version from pip and docker and set version | |
id: getversion | |
run: | | |
./scripts/auto_publish/compare-versions | |
- name: VERSION found | |
if: "${{ steps.getversion.outputs.version != '' }}" | |
run: echo ${{ steps.getversion.outputs.version }} | |
- name: Log in to Docker Hub | |
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@v6 | |
if: "${{ steps.getversion.outputs.version != '' }}" | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} | |
build-args: | | |
CZ_VERSION=${{ steps.getversion.outputs.version }} | |
tags: | | |
commitizen/commitizen:3 | |
commitizen/commitizen:latest | |
commitizen/commitizen:${{ steps.getversion.outputs.version }} |