fime/.gitlab-ci.yml

52 lines
1.2 KiB
YAML

image: python:3.10
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PIPENV_VENV_IN_PROJECT: 1
stages:
- build
- deploy
- release
cache:
paths:
- .cache/pip
- .venv/
package_linux:
stage: build
before_script:
- python --version
- pip install pipenv
- pipenv sync --dev
script:
- VERSION=$(pipenv run python -m setuptools_scm)
- echo $VERSION | tee version.txt
- pipenv run python -m build -w
- pipenv run pyinstaller --onefile --strip --name fime_linux_${VERSION} src/fime/main.py
artifacts:
paths:
- version.txt
- dist/*.whl
- dist/fime_linux_*
upload:
image: curlimages/curl:latest
stage: deploy
script:
- VERSION=$(cat version.txt)
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file dist/fime_linux_${VERSION} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/fime/${VERSION}/fime_linux_${VERSION}"'
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script:
- echo "Running the release job."
release:
tag_name: $CI_COMMIT_TAG
name: 'Release $CI_COMMIT_TAG'
description: 'Release created using the release-cli.'