Skip to content

Commit

Permalink
Automate the publishing of the container image
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Feb 9, 2024
1 parent 3d22c85 commit 0111a12
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ on:
- "v*"
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
id-token: write
packages: write
steps:
- name: "Check out source code"
uses: "actions/checkout@v4"
Expand All @@ -26,4 +25,25 @@ jobs:
run: python -m build
- name: "Publish"
uses: pypa/gh-action-pypi-publish@release/v1

- name: Capture Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/artefactual-labs/a3m
tags: |
type=semver,pattern={{raw}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ See the fragment files in the `changelog.d directory`_.
0.7.7 — 2024-02-09
==================

Added
-----

- Automate the build and plublishing of the container image to GitHub Container
Registry.

Fixed
-----

Expand Down
16 changes: 5 additions & 11 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,10 @@ Please adhere to the following instructions:
$ git tag v0.7.7
$ git push origin refs/tags/v0.7.7

This should have triggered the publishing workflow. Confirm that the new
version of the package is in `PyPI <https://pypi.org/project/a3m/>`_.
This should have triggered the publishing workflow. Please confirm that the
new version of the package is available on `PyPI`_ and that the container
image has been published to the `GitHub Container Registry`_.

4. Build Docker image::

$ docker build \
-t ghcr.io/artefactual-labs/a3m:latest \
-t ghcr.io/artefactual-labs/a3m:v0.7.7 \
.
5. Push Docker image to the registry::

$ docker push ghcr.io/artefactual-labs/a3m:latest
$ docker push ghcr.io/artefactual-labs/a3m:v0.7.7
.. _PyPI: https://pypi.org/project/a3m/
.. _GitHub Container Registry: https://ghcr.io/artefactual-labs/a3m

0 comments on commit 0111a12

Please sign in to comment.