diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c02e2cdebdde229d044a0dc5023d717045eb517a..5f1c18824d15ea7671e2572d1af53a3170c26c47 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ stages: - build - test - # - deploy + - publish create-venv: stage: build @@ -60,3 +60,13 @@ test_coverage: artifacts: paths: - test_results/coverage_html/ + +publish-pypi: + stage: publish + rules: + - if: $CI_COMMIT_TAG + image: python:3.8 + tags: + - grid5000-docker + script: + - make release diff --git a/Makefile b/Makefile index 2b66641b9c474150988f1a55786288d0d432dc54..7484ca784e658d4635fa31cdaa1a627e18f4c258 100644 --- a/Makefile +++ b/Makefile @@ -95,16 +95,17 @@ integration: clean_cache venv check_format lint installable test_coverage # clean_cache will make sure we download the last versions of linters. # Use `make -k integration` to run all checks even if previous fails. -release: integration +release: clean_cache venv installable echo "Releasing submitit_oar $(CURRENT_VERSION)" [ ! -d dist ] || rm -r dist # Make sure the repo is in a clean state git diff --exit-code + # Make sure we're creating a release for a tag which matches the version. + [ "`git describe --tag --exact-match $(git rev-parse HEAD)`" = "$(CURRENT_VERSION)" ] && echo "Found a tag matching current version" + # FLIT_PASSWORD is set by gitlab's variable environments. + [ -n "$(FLIT_PASSWORD)" ] || (echo "FLIT_PASSWORD not set, fix gitlab's variables, or provide it" && exit 1) # --setup-py generates a setup.py file to allow user with old # versions of pip to install it without flit. - git tag $(CURRENT_VERSION) # To have a reproducible build we use the timestamp of the last commit: # https://flit.pypa.io/en/latest/reproducible.html - SOURCE_DATE_EPOCH=`git log -n1 --format=%cd --date=unix` $(BIN)python -m flit publish --setup-py - git checkout HEAD -- README.md - git push origin $(CURRENT_VERSION) + FLIT_USERNAME="__token__" SOURCE_DATE_EPOCH=`git log -n1 --format=%cd --date=unix` $(BIN)python -m flit publish --setup-py diff --git a/README.md b/README.md index d6907aaf5cc3c1f1234a7ecdfbca7dc4db342923..37e9f26c9717e4624178a291b7ba9dc62db43d79 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,8 @@ assert output == 12 ``` You can try running this above example with a breakpoint at https://github.com/facebookincubator/submitit/blob/main/submitit/core/plugins.py#L33, to be sure that Submitit correctly finds the submitit_oar plugin. + +# Releasing submitit_oar + +Create a tag matching the version to release in gitlab, it should create a pipeline which will push the package to PyPi. +If you want to do this manually, populate the `FLIT_PASSWORD` environment variable with the API token, and run `make release` diff --git a/submitit_oar/__init__.py b/submitit_oar/__init__.py index c2bd7afaf4ef8a57a3d0ad715315f910783b245c..bf4afe9e0278a086a64d6bd2cef3c044a21e3d5a 100644 --- a/submitit_oar/__init__.py +++ b/submitit_oar/__init__.py @@ -3,4 +3,4 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -__version__ = "1.1.0" +__version__ = "1.1.1"