Skip to content

Commit f7dd9b3

Browse files
authored
Merge pull request #120 from codelion/codelion-patch-1
Update publish.yml
2 parents 417dc71 + 193f900 commit f7dd9b3

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

.github/workflows/publish.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
name: Upload Python Package to PyPI when a Release is Created
2-
1+
name: Upload Python Package and Docker Image on Release
32
on:
43
release:
54
types: [created]
@@ -25,6 +24,44 @@ jobs:
2524
pip install setuptools wheel
2625
- name: Build package
2726
run: |
28-
python setup.py sdist bdist_wheel # Could also be python -m build
27+
python setup.py sdist bdist_wheel
2928
- name: Publish package distributions to PyPI
3029
uses: pypa/gh-action-pypi-publish@release/v1
30+
31+
docker-publish:
32+
name: Publish Docker image
33+
runs-on: ubuntu-latest
34+
needs: pypi-publish
35+
permissions:
36+
contents: read
37+
packages: write
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
43+
44+
- name: Log in to GitHub Container Registry
45+
uses: docker/login-action@v3
46+
with:
47+
registry: ghcr.io
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Extract metadata for Docker
52+
id: meta
53+
uses: docker/metadata-action@v5
54+
with:
55+
images: ghcr.io/${{ github.repository }}
56+
tags: |
57+
type=semver,pattern={{version}}
58+
type=semver,pattern={{major}}.{{minor}}
59+
latest
60+
61+
- name: Build and push Docker image
62+
uses: docker/build-push-action@v5
63+
with:
64+
context: .
65+
push: true
66+
tags: ${{ steps.meta.outputs.tags }}
67+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)