diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..f7275bbbd035b827023cbae18954c0703b200c34 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +venv/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 41e9a25f2205413fbae3eb684219be6823fa22c6..18dac071326dd970c17935edef9f1f103b5d0ca7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ workflow: stages: - test + - release - build variables: @@ -34,21 +35,33 @@ lint dockerfile: changes: - Dockerfile +release: + stage: release + image: docker.io/python:3.8-alpine + before_script: + - pip install --user --requirement requirements.ci.txt + script: + - semantic-release --verbosity=DEBUG publish + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + build container image: stage: build image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: + - "[[ -n $CI_COMMIT_TAG ]] && export version=$CI_COMMIT_TAG || export version=$CI_COMMIT_SHORT_SHA" - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64 | tr -d '\n')\"},\"$harbor_registry\":{\"auth\":\"$HARBOR_ROBOT_TOKEN64\"}}}" > /kaniko/.docker/config.json - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --build-arg build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ') - --build-arg vcs_ref=${CI_COMMIT_SHORT_SHA} - --build-arg version=${CI_COMMIT_SHORT_SHA} - --destination $CI_REGISTRY_IMAGE/repdav:$CI_COMMIT_SHORT_SHA - --destination $harbor_registry/$harbor_repo/repdav:$CI_COMMIT_SHORT_SHA + --build-arg vcs_ref=${version} + --build-arg version=${version} + --destination $CI_REGISTRY_IMAGE/repdav:$version + --destination $harbor_registry/$harbor_repo/repdav:$version rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_COMMIT_TAG diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..3f57bc936fcb565e86410d6f96ff9bd0f2b3bee2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,11 @@ +[tool.semantic_release] +version_source = "tag" +branch = "main" +major_on_zero = false +tag_format = "{version}" +build_command = false +upload_to_repository = false +hvcs = "gitlab" +hvcs_domain = "gitlab.gwdg.de" +hvcs_api_domain = "gitlab.gwdg.de/api/v4" +check_build_status = true diff --git a/requirements.ci.txt b/requirements.ci.txt new file mode 100644 index 0000000000000000000000000000000000000000..65e34489b55addb73e7db573da2279c234a1b1f3 --- /dev/null +++ b/requirements.ci.txt @@ -0,0 +1 @@ +python-semantic-release==7.25.0