diff --git a/.github/workflows/Publish.yaml b/.github/workflows/Publish.yaml index 7810ea3..35b3c71 100644 --- a/.github/workflows/Publish.yaml +++ b/.github/workflows/Publish.yaml @@ -37,16 +37,15 @@ jobs: # password: ${{ secrets.PYPI_TEST_API_TOKEN }} # repository_url: https://test.pypi.org/legacy/ - - name: Build and push Docker image - uses: openzim/docker-publish-action@v10 - with: - image-name: openzim/great-project - tag-pattern: /^v([0-9.]+)$/ - latest-on-tag: true - restrict-to: openzim/_python-bootstrap - registries: ghcr.io - credentials: - GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }} - GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }} - repo_description: auto - repo_overview: auto + docker-publish: + name: Build and push Docker image + if: github.repository == 'openzim/_python-bootstrap' + needs: publish + uses: openzim/overview/.github/workflows/docker-publish.yaml@v1 + with: + image-name: openzim/great-project + tag-pattern: /^v([0-9.]+)$/ + latest-on-tag: true + secrets: + ghcr_username: ${{ secrets.GHCR_USERNAME }} + ghcr_token: ${{ secrets.GHCR_TOKEN }} diff --git a/.github/workflows/PublishDockerDevImage.yaml b/.github/workflows/PublishDockerDevImage.yaml index 3fd398a..ae5f909 100644 --- a/.github/workflows/PublishDockerDevImage.yaml +++ b/.github/workflows/PublishDockerDevImage.yaml @@ -7,21 +7,12 @@ on: jobs: publish: - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v4 - - - name: Build and push Docker image - uses: openzim/docker-publish-action@v10 - with: - image-name: openzim/great-project - manual-tag: dev - latest-on-tag: false - restrict-to: openzim/_python-bootstrap - registries: ghcr.io - credentials: - GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }} - GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }} - repo_description: auto - repo_overview: auto + if: github.repository == 'openzim/_python-bootstrap' + uses: openzim/overview/.github/workflows/docker-publish.yaml@v1 + with: + image-name: openzim/great-project + latest-on-tag: false + manual-tag: dev + secrets: + ghcr_username: ${{ secrets.GHCR_USERNAME }} + ghcr_token: ${{ secrets.GHCR_TOKEN }} diff --git a/docs/Dockerfile-and-Publish-workflow.md b/docs/Dockerfile-and-Publish-workflow.md index 1516eaa..33e9f85 100644 --- a/docs/Dockerfile-and-Publish-workflow.md +++ b/docs/Dockerfile-and-Publish-workflow.md @@ -51,13 +51,35 @@ on: types: [published] ``` -## Publish action - -Except if not appropriate, we recommend to use our specific Github action : [openzim/docker-publish-action](https://github.com/openzim/docker-publish-action) which handles building the image and publishing it. +## Publish workflow + +Except if not appropriate, we recommend to call our reusable workflow +[openzim/overview/.github/workflows/docker-publish.yaml](https://github.com/openzim/overview/blob/main/.github/workflows/docker-publish.yaml), +which handles building the image (each architecture on its own native runner) and publishing it. Its inputs +are documented in [Publishing Docker images](https://github.com/openzim/overview/wiki/Publishing-Docker-images). + +```yaml +jobs: + docker-publish: + if: github.repository == 'openzim/great-project' + uses: openzim/overview/.github/workflows/docker-publish.yaml@v1 + with: + image-name: openzim/great-project + tag-pattern: /^v([0-9.]+)$/ + latest-on-tag: true + secrets: + ghcr_username: ${{ secrets.GHCR_USERNAME }} + ghcr_token: ${{ secrets.GHCR_TOKEN }} +``` Some quirks not to forget: - Image name convention is to use dashes not underscores +- a job calling a reusable workflow cannot have `steps`, so anything else the release workflow does (building + and uploading the Python package, for instance) belongs in its own job, which the publishing job waits on + with `needs:` +- [openzim/docker-publish-action](https://github.com/openzim/docker-publish-action), which we used before, is + deprecated: do not use it in new projects ## Registry