Skip to content

Commit 722ede9

Browse files
ci(release): publish to PyPI and GHCR on tag (#48)
* ci(release): publish to PyPI and GHCR on tag * ci(release): guard PyPI when no PYPI_API_TOKEN
1 parent 1eec229 commit 722ede9

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: release
2+
on:
3+
push:
4+
tags: ['v*']
5+
permissions:
6+
contents: write
7+
packages: write
8+
jobs:
9+
build-publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with: { python-version: '3.12' }
15+
- name: Build
16+
run: |
17+
python -m pip install -U pip build
18+
python -m build
19+
- uses: actions/upload-artifact@v4
20+
with: { name: dist, path: dist/* }
21+
- name: Publish to PyPI
22+
if: startsWith(github.ref, 'refs/tags/v') && secrets.PYPI_API_TOKEN != ''
23+
uses: pypa/gh-action-pypi-publish@release/v1
24+
with:
25+
user: __token__
26+
password: ${{ secrets.PYPI_API_TOKEN }}
27+
publish-ghcr:
28+
needs: build-publish
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
packages: write
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: docker/login-action@v3
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
- uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
push: true
44+
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ github.ref_name }}

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM python:3.12-slim
2+
WORKDIR /app
3+
COPY . /app
4+
RUN pip install --no-cache-dir .
5+
ENTRYPOINT ["python","-m","diff_risk_dashboard"]

0 commit comments

Comments
 (0)