Add 'publish' stage to .gitlab-ci.yml

We add a new 'publish' stage in .gitlab-ci.yml to handle publishing artifacts.
This commit is contained in:
Kumi 2023-08-23 09:57:39 +02:00
parent 3d5ee20c2a
commit 14cc55b3df
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -2,6 +2,7 @@ image: python:3.10
stages: stages:
- test - test
- publish
before_script: before_script:
- python -V - python -V
@ -9,9 +10,19 @@ before_script:
- source venv/bin/activate - source venv/bin/activate
- pip install -U pip - pip install -U pip
- pip install . - pip install .
- echo "[CarbonTracer]" > config.ini
- echo "key = ${API_KEY}" >> config.ini
test: test:
stage: test stage: test
script: python -m unittest test.py script:
- echo "[CarbonTracer]" > config.ini
- echo "key = ${API_KEY}" >> config.ini
- python -m unittest test.py
publish:
stage: publish
script:
- pip install -U hatchling twine build
- python -m build .
- python -m twine upload --username __token__ --password ${PYPI_TOKEN} dist/*
only:
- tags