2024-08-01 02:26:23 +02:00
|
|
|
image: python:3.10
|
2020-01-19 15:25:00 +01:00
|
|
|
|
|
|
|
stages:
|
2020-01-19 16:00:40 +01:00
|
|
|
- package
|
2024-08-01 02:26:23 +02:00
|
|
|
- release
|
2020-01-19 15:25:00 +01:00
|
|
|
|
2020-01-28 00:51:59 +01:00
|
|
|
|
2020-01-19 16:00:40 +01:00
|
|
|
pypi-package:
|
|
|
|
stage: package
|
2020-01-19 15:25:00 +01:00
|
|
|
only:
|
2020-01-19 16:00:40 +01:00
|
|
|
- tags
|
2020-01-19 15:25:00 +01:00
|
|
|
script:
|
2024-08-01 02:26:23 +02:00
|
|
|
- apt-get update -y && apt-get install -y curl
|
|
|
|
- curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
- export PATH="/root/.local/bin:$PATH"
|
|
|
|
- poetry build
|
|
|
|
- poetry publish
|
2020-01-19 15:25:00 +01:00
|
|
|
|
|
|
|
.write_permission: &write_permission |
|
|
|
|
git config --global user.email "gitlab-ci"; git config --global user.name "gitlab-ci"
|
|
|
|
url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
|
|
|
|
git remote set-url origin "https://gitlab-ci-token:${CI_TAG_UPLOAD_TOKEN}@${url_host}"
|
|
|
|
|
|
|
|
tag:
|
2020-01-19 16:00:40 +01:00
|
|
|
stage: release
|
2020-01-19 15:25:00 +01:00
|
|
|
only:
|
2021-05-21 15:17:47 +02:00
|
|
|
- main
|
2020-01-19 15:25:00 +01:00
|
|
|
script:
|
|
|
|
- *write_permission
|
2024-08-04 21:24:31 +02:00
|
|
|
- export VERSION=$(grep -m 1 version pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
|
2024-08-01 02:26:23 +02:00
|
|
|
- git tag -a $VERSION -m "Version created by gitlab-ci release"
|
2020-01-19 15:25:00 +01:00
|
|
|
- git push origin $VERSION
|
2024-08-04 22:36:26 +02:00
|
|
|
|
|
|
|
build_image:
|
2024-08-04 22:37:24 +02:00
|
|
|
stage: release
|
2024-08-04 22:36:26 +02:00
|
|
|
image: docker:latest
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
only:
|
|
|
|
- main
|
|
|
|
script:
|
|
|
|
- export VERSION=$(grep -m 1 version pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
|
|
|
|
- export LATEST_IMAGE_TAG=ghcr.io/${GH_REGISTRY_USER}/humblebundle-downloader:latest
|
|
|
|
- export VERSION_IMAGE_TAG=ghcr.io/${GH_REGISTRY_USER}/humblebundle-downloader:$VERSION
|
|
|
|
- echo $GH_REGISTRY_PASSWORD | docker login -u $GH_REGISTRY_USER ghcr.io --password-stdin
|
|
|
|
- docker build -t $LATEST_IMAGE_TAG -t $VERSION_IMAGE_TAG .
|
|
|
|
- docker push $LATEST_IMAGE_TAG
|
|
|
|
- docker push $VERSION_IMAGE_TAG
|