|
| 1 | +name: Publish Docker image |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # At the end of every day |
| 6 | + - cron: '0 0 * * *' |
| 7 | + workflow_dispatch: |
| 8 | + # inputs: |
| 9 | + # run: |
| 10 | + # description: 'Dummy button' |
| 11 | + # required: false |
| 12 | + # default: true |
| 13 | + # type: boolean |
| 14 | + |
| 15 | +jobs: |
| 16 | + push_to_registry: |
| 17 | + name: Push Docker image to Docker Hub |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Check out the repo |
| 21 | + uses: actions/checkout@v2 |
| 22 | + - name: Set up Python 3.10 |
| 23 | + uses: actions/setup-python@v2 |
| 24 | + with: |
| 25 | + python-version: '3.10' |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + python -m pip install -U pip |
| 29 | + sudo apt-get install wget grep |
| 30 | + - name: Compare version from pip and docker and set version |
| 31 | + id: getversion |
| 32 | + run: | |
| 33 | + ./scripts/auto_publish/compare-versions |
| 34 | + - name: VERSION found |
| 35 | + if: "${{ steps.getversion.outputs.version != '' }}" |
| 36 | + run: echo ${{ steps.getversion.outputs.version }} |
| 37 | + - name: Log in to Docker Hub |
| 38 | + uses: docker/login-action@v2 |
| 39 | + if: "${{ steps.getversion.outputs.version != '' }}" |
| 40 | + with: |
| 41 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 42 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 43 | + - name: Build and push Docker image |
| 44 | + uses: docker/build-push-action@v2 |
| 45 | + if: "${{ steps.getversion.outputs.version != '' }}" |
| 46 | + with: |
| 47 | + context: . |
| 48 | + push: true |
| 49 | + build-args: | |
| 50 | + CZ_VERSION=${{ steps.getversion.outputs.version }} |
| 51 | + tags: | |
| 52 | + commitizen/commitizen:2 |
| 53 | + commitizen/commitizen:latest |
| 54 | + commitizen/commitizen:${{ steps.getversion.outputs.version }} |
0 commit comments