Skip to content
Snippets Groups Projects
Commit eaae3e1b authored by Thibault Ehrhart's avatar Thibault Ehrhart
Browse files

ci: add pypi package publishing

parent 2c79dd53
No related branches found
No related tags found
1 merge request!3ci: add pypi package publishing
......@@ -5,6 +5,16 @@ stages:
- release
.poetry_setup: &poetry_setup
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
POETRY_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pypoetry"
POETRY_VIRTUALENVS_IN_PROJECT: "true"
cache:
paths:
- .cache/pip
- .cache/pytest_cache
- .cache/pypoetry
- .venv
before_script:
- python -V
- python -m pip install --upgrade pip
......@@ -15,18 +25,8 @@ stages:
test:
<<: *poetry_setup
image: python:3.9
stage: test
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
POETRY_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pypoetry"
POETRY_VIRTUALENVS_IN_PROJECT: "true"
cache:
paths:
- .cache/pip
- .cache/pytest_cache
- .cache/pypoetry
- .venv
image: python:3.9
script:
- poetry run coverage run
- poetry run coverage report
......@@ -40,8 +40,8 @@ test:
path: coverage.xml
build:
image: tobix/pywine:3.9
stage: build
image: tobix/pywine:3.9
script:
- wine python -m pip install poetry --no-warn-script-location
- wine poetry install
......@@ -60,10 +60,14 @@ upload:
- |
PACKAGE_VERSION=$(grep -m1 version pyproject.toml | cut -d '"' -f2)
PACKAGE_REGISTRY_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${PACKAGE_VERSION}"
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file dist/*.msi "${PACKAGE_REGISTRY_URL}/${CI_PROJECT_NAME}-${PACKAGE_VERSION}-windows-x86_64.msi"
- >
curl
--header "JOB-TOKEN: ${CI_JOB_TOKEN}"
--upload-file dist/*.msi "${PACKAGE_REGISTRY_URL}/${CI_PROJECT_NAME}-${PACKAGE_VERSION}-windows-x86_64.msi"
- |
echo 'Package uploaded!'
release:
release_generic:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
......@@ -81,3 +85,15 @@ release:
--assets-link "{\"name\":\"${CI_PROJECT_NAME}-${PACKAGE_VERSION}-windows-x86_64.msi\",\"url\":\""${PACKAGE_REGISTRY_URL}/${CI_PROJECT_NAME}-${PACKAGE_VERSION}-windows-x86_64.msi"\"}"
- |
echo 'Created released of ${CI_PROJECT_NAME}!'
release_pypi:
<<: *poetry_setup
stage: release
image: python:3.9
rules:
- if: $CI_COMMIT_TAG
script:
- poetry build
- poetry config repositories.gitlab "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi"
- poetry config http-basic.gitlab gitlab-ci-token "${CI_JOB_TOKEN}"
- poetry publish --repository gitlab
......@@ -48,7 +48,7 @@ For other operating systems (macOS, Linux), you can install the tool using `pipx
For a more flexible installation, you can use [`pipx`](https://pipx.pypa.io/) to install `ineedaroom`.
```bash
pipx install git+https://gitlab.eurecom.fr/tehrhart/ineedaroom.git
pipx install ineedaroom --index-url https://gitlab.eurecom.fr/api/v4/projects/6364/packages/pypi/simple
```
Later on, you can update the tool to the latest version using the following command:
......@@ -62,7 +62,7 @@ pipx upgrade ineedaroom
Alternatively, you can install `ineedaroom` using `pip`. This method is suitable if you're comfortable managing Python packages and have Python 3.9 or later installed:
```bash
pip install --user git+https://gitlab.eurecom.fr/tehrhart/ineedaroom.git
pip install --user ineedaroom --index-url https://gitlab.eurecom.fr/api/v4/projects/6364/packages/pypi/simple
```
## Development
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment