Commit cff6c4ea authored by Ruben ten Hove's avatar Ruben ten Hove
Browse files

feat: automatically set releaserc assets

parent 24a68dff
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@

variables:
  SCHEDULE_PIPELINE_PROJECT_IDS: 30771297 30771293 30771284 30771254 30771239
  GITLAB_RECOMMENDED_AUTO_FIX: "true"

include:
  - local: pipelines/project-automation.yml
@@ -11,10 +12,6 @@ include:
  - local: project-automation/pages-hugo.yml
  - local: docs/prettier.yml

gitlab:recommended:
  variables:
    GITLAB_RECOMMENDED_AUTO_FIX: "true"

pages:
  stage: test
  before_script:

.releaserc

deleted100644 → 0
+0 −24
Original line number Diff line number Diff line
{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "@semantic-release/gitlab",
    ["@semantic-release/git", {
      "assets": ["README.md", "tbump.toml", "pipelines/container.md", "python/*.yml"]
    }]
  ],
  "branches": [
    "+([0-9])?(.{+([0-9]),x}).x",
    "main",
    "next",
    "next-major",
    {
      "name": "beta",
      "prerelease": true
    },
    {
      "name": "alpha",
      "prerelease": true
    }
  ]
}
+0 −1
Original line number Diff line number Diff line
---
include:
  - local: project-automation/badge.yml
  - local: project-automation/check-GL-token.yml

.badge:md-presentation:
  extends: .badge
+7 −23
Original line number Diff line number Diff line
---
include:
  - local: project-automation/workflow.yml
  - local: "project-automation/find-next-release.yml"
  - local: "project-automation/gitlab-recommended.yml"
  - local: "project-automation/semantic-release.yml"
  - local: "project-automation/check-GL-token.yml"
  - local: "python/tbump.yml"
  - local: project-automation/find-next-release.yml
  - local: project-automation/gitlab-recommended.yml
  - local: project-automation/semantic-release.yml
  - local: project-automation/generic.yaml
  - local: python/tbump.yml

tbump:
  rules:
    # tbump does not work easily with versions not compliant with PEP440
    # e.g. v1.0.1-beta.1 is not PEP440 compliant
    # but it's the default used by semantic-release
    # as a temporary workaround we run tbump only on default branch
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      exists:
        - tbump.toml
        - pyproject.toml

tbump:check:
  extends: tbump
  rules:
    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
      exists:
        - tbump.toml
        - pyproject.toml
  artifacts: null
  extends: .release:rules
  needs: [find-next-release]
+9 −12
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
# according to your preferences.

# Choose a color from this list: https://github.com/jongracecox/anybadge#colors
include:
  - local: project-automation/generic.yaml

.badge:
  image: registry.gitlab.com/just-ci/images/anybadge:latest
@@ -40,6 +42,9 @@
    - |
      if [ "${DISABLE_BADGE_CREATION}" != "" ]; then
        exit 0
      elif [ "${GL_TOKEN}" == "" ]; then
        echo "[!] No GL_TOKEN set. If you want to disable badge creation, set a variable called DISABLE_BADGE_CREATION to any value."
        exit 1
      fi
    - |
      echo "[*] Creating/updating badge..."
@@ -55,7 +60,7 @@
      if [ "${STATUS_CODE:0:1}" = "2" ]; then
        echo "[+] Badge set successfully."
      elif [ "${STATUS_CODE}" = "403" ]; then
        echo "[!] Access Forbidden. Does GL_TOKEN have access to badge creation? A Personal Access Token requires at least a Maintainer user."
        echo "[!] Access Forbidden. Does your GL_TOKEN have access to badge creation?"
        exit 1
      else
        echo "[!] Something went wrong. We received the status code ${STATUS_CODE}."
@@ -69,19 +74,11 @@
  rules:
    - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"

badge:GL_TOKEN-required:
  stage: .pre
  image: docker.io/alpine:3
badge:GL_TOKEN:
  extends: .fix:GL_TOKEN
  variables:
    GIT_STRATEGY: none
  script:
    - |
      echo "[!] GL_TOKEN not set. Please add a GL_TOKEN per the instructions: https://gitlab.com/just-ci/templates#how-to-use"
      echo "[!] Badges will not be created automatically, but will be available for use elsewhere."
      echo "[!] You can disable this warning by setting a variable called DISABLE_BADGE_CREATION in your .gitlab-ci.yml."
    - exit 1
    JOB_NAME: badge
  rules:
    - if:
        "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $GL_TOKEN == null &&
        $DISABLE_BADGE_CREATION == null"
  allow_failure: true
Loading