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:
parent
3d5ee20c2a
commit
14cc55b3df
1 changed files with 14 additions and 3 deletions
|
@ -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
|
Loading…
Reference in a new issue