diff --git a/.gitlab/workflows/ci.yml b/.gitlab/workflows/ci.yml index 29ac5f6f..7b92aef9 100644 --- a/.gitlab/workflows/ci.yml +++ b/.gitlab/workflows/ci.yml @@ -43,3 +43,17 @@ consistency: - git status --porcelain - test -z "$(git status --porcelain)" stage: ci +semantic-release: + image: + name: node:20.13.1 + interruptible: true + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_NAMESPACE == "serious-scaffold" && $CI_PROJECT_NAME == "ss-python" + script: + - > + npx + -p @semantic-release/gitlab@13 + -p conventional-changelog-conventionalcommits@7 + -p semantic-release@23 + semantic-release + stage: release diff --git a/.gitlab/workflows/release.yml b/.gitlab/workflows/release.yml index e1d5e92c..6ddc9d9e 100644 --- a/.gitlab/workflows/release.yml +++ b/.gitlab/workflows/release.yml @@ -2,8 +2,6 @@ pages-build: artifacts: paths: - public - - docs/changelog.md - - release-notes.md cache: paths: - .venv @@ -17,26 +15,22 @@ pages-build: script: - make dev-doc - make doc - - make release-notes > release-notes.md stage: release -release-publish: - image: registry.gitlab.com/gitlab-org/release-cli:v0.18.0@sha256:696013aea0f2a20482800ce3a77341f840d7c7ec17bd78bd555e0bd6c00e4f11 +pages: + artifacts: + paths: + - public needs: - pages-build - release: - description: release-notes.md - tag_name: $CI_COMMIT_TAG rules: - if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/ script: - - echo "Running the release job." + - echo "Running the pages job." stage: release variables: GIT_STRATEGY: none container-publish: image: docker:26.1.2@sha256:c890c327e515cdccd14e593fb5450e4375e791ab0520795948134cb87b45aaa7 - needs: - - release-publish parallel: matrix: - PYTHON_VERSION: @@ -82,24 +76,8 @@ container-publish: PYTHON_VERSION: ${PYTHON_VERSION} SOURCE_DATE_EPOCH: 0 package-publish: - needs: - - release-publish rules: - if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/ script: - make publish stage: release -pages: - artifacts: - paths: - - public - needs: - - pages-build - - release-publish - rules: - - if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/ - script: - - echo "Running the pages job." - stage: release - variables: - GIT_STRATEGY: none diff --git a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/ci.yml.jinja b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/ci.yml.jinja index f8e5ef16..7d55494c 100644 --- a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/ci.yml.jinja +++ b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/ci.yml.jinja @@ -56,3 +56,17 @@ consistency: - test -z "$(git status --porcelain)" stage: ci [%- endif %] +semantic-release: + image: + name: node:20.13.1 + interruptible: true + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_NAMESPACE == "{{ repo_namespace }}" && $CI_PROJECT_NAME == "{{ repo_name }}" + script: + - > + npx + -p @semantic-release/gitlab@13 + -p conventional-changelog-conventionalcommits@7 + -p semantic-release@23 + semantic-release + stage: release diff --git a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja index 8fa77153..0c451e57 100644 --- a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja +++ b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja @@ -3,8 +3,6 @@ pages-build: artifacts: paths: - public - - docs/changelog.md - - release-notes.md cache: paths: - .venv @@ -18,26 +16,22 @@ pages-build: script: - make dev-doc - make doc - - make release-notes > release-notes.md stage: release -release-publish: - image: registry.gitlab.com/gitlab-org/release-cli:v0.18.0@sha256:696013aea0f2a20482800ce3a77341f840d7c7ec17bd78bd555e0bd6c00e4f11 +pages: + artifacts: + paths: + - public needs: - pages-build - release: - description: release-notes.md - tag_name: $CI_COMMIT_TAG rules: - if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/ script: - - echo "Running the release job." + - echo "Running the pages job." stage: release variables: GIT_STRATEGY: none container-publish: image: docker:26.1.2@sha256:c890c327e515cdccd14e593fb5450e4375e791ab0520795948134cb87b45aaa7 - needs: - - release-publish parallel: matrix: - PYTHON_VERSION: @@ -93,24 +87,8 @@ container-publish: PYTHON_VERSION: ${PYTHON_VERSION} SOURCE_DATE_EPOCH: 0 package-publish: - needs: - - release-publish rules: - if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/ script: - make publish stage: release -pages: - artifacts: - paths: - - public - needs: - - pages-build - - release-publish - rules: - - if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/ - script: - - echo "Running the pages job." - stage: release - variables: - GIT_STRATEGY: none diff --git a/template/package.json b/template/package.json.jinja similarity index 92% rename from template/package.json rename to template/package.json.jinja index 71a24212..ce0ba734 100644 --- a/template/package.json +++ b/template/package.json.jinja @@ -118,7 +118,18 @@ } } ], +[%- if repo_platform == 'github' %] "@semantic-release/github" +[%- elif repo_platform == 'gitlab' %] + "@semantic-release/gitlab" +[%- elif repo_platform == 'gitlab-self-managed' %] + [ + "@semantic-release/gitlab", + { + "gitlabUrl": "https://{{ repo_host }}" + } + ] +[%- endif %] ], "preset": "conventionalcommits" }