Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions .github/workflows/Publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
27 changes: 9 additions & 18 deletions .github/workflows/PublishDockerDevImage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
28 changes: 25 additions & 3 deletions docs/Dockerfile-and-Publish-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading