Skip to content

Commit 9b3c8b0

Browse files
author
marci
committed
ci: add TestPyPI upload using TEST_PYPI_API_TOKEN; keep prod PyPI disabled
1 parent 71e29b5 commit 9b3c8b0

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/ci-cd.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ jobs:
135135
if: github.repository_owner == 'securebitsorg' && github.event_name == 'release' && github.event.action == 'published'
136136
env:
137137
TWINE_USERNAME: __token__
138-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
138+
TWINE_PASSWORD: ${{ env.testpypi }}
139139
run: |
140140
python -m twine upload dist/*
141141
@@ -206,10 +206,7 @@ jobs:
206206
id: meta
207207
uses: docker/metadata-action@v5
208208
with:
209-
images: ghcr.io/${{ steps.repo.outputs.name }}
210-
tags: |
211-
# Git-Branch oder Tag als Tag verwenden
212-
type=ref,event=branch
209+
images: ghcr.io/${{ steps.repo.outputs.name }}cenv.testpypi
213210
type=ref,event=pr
214211
type=ref,event=tag
215212
# Immer 'latest' Tag für den Default-Branch
@@ -327,10 +324,24 @@ jobs:
327324
- name: Download build artifacts for release (Fallback)
328325
if: success()
329326
uses: actions/download-artifact@v4
330-
with:
327+
with:c
331328
name: python-package
332329
path: dist/
333330

331+
- name: Install Twine for TestPyPI upload
332+
if: success() && env.testpypi != ''
333+
run: |
334+
python -m pip install --upgrade pip
335+
pip install twine
336+
337+
- name: Publish to TestPyPI
338+
if: success() && env.testpypi != ''
339+
env:
340+
TWINE_USERNAME: __token__
341+
TWINE_PASSWORD: ${{ env.testpypi }}
342+
run: |
343+
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
344+
334345
- name: Create GitHub Release (Fallback)
335346
if: success()
336347
env:

0 commit comments

Comments
 (0)