-
Notifications
You must be signed in to change notification settings - Fork 11
/
.gitlab-ci.yml
53 lines (49 loc) · 1.1 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
stages:
- build
- publish
- release
.if-tag: &if-tag
if: "$CI_COMMIT_TAG =~ /^qi-python-v/"
build-wheel:
stage: build
rules:
# Allow manually building on a Git commit on any branch.
- if: $CI_COMMIT_BRANCH
when: manual
# Always build on a Git tag.
- <<: *if-tag
tags:
- docker
image: python:3.8
script:
- curl -sSL https://get.docker.com/ | sh
- pip install cibuildwheel==2.14.1
- cibuildwheel --output-dir wheelhouse
artifacts:
paths:
- wheelhouse/
publish-wheel:
stage: publish
image: python:latest
rules:
- <<: *if-tag
needs:
- build-wheel
script:
- pip install build twine
- python -m build
- TWINE_PASSWORD="${CI_JOB_TOKEN}"
TWINE_USERNAME=gitlab-ci-token
python -m twine upload
--repository-url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi"
wheelhouse/*
create-release:
stage: release
rules:
- <<: *if-tag
script:
- echo "Releasing $CI_COMMIT_TAG."
release:
tag_name: $CI_COMMIT_TAG
name: 'lib$CI_COMMIT_TITLE'
description: '$CI_COMMIT_TAG_MESSAGE'