From fb0e66fb4000b71c76ea0d47483293da08c60ab8 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Tue, 20 Feb 2024 12:31:07 +0800 Subject: [PATCH] chore: add initial version of renovate config --- .github/workflows/renovate.yml | 39 ++++++++++++++++++++++++++++++ .gitlab/workflows/ci.yml | 2 +- .gitlab/workflows/commitlint.yml | 2 +- .gitlab/workflows/devcontainer.yml | 3 ++- .gitlab/workflows/renovate.yml | 27 +++++++++++++++++++++ .renovaterc.json | 15 ++++++++++++ .vscode/settings.json | 2 ++ 7 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/renovate.yml create mode 100644 .gitlab/workflows/renovate.yml create mode 100644 .renovaterc.json diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml new file mode 100644 index 00000000..01b18aa6 --- /dev/null +++ b/.github/workflows/renovate.yml @@ -0,0 +1,39 @@ +name: Renovate +jobs: + renovate: + container: + env: + LOG_LEVEL: debug + RENOVATE_BRANCH_PREFIX: renovate-github/ + RENOVATE_ENABLED_MANAGERS: '["pep621", "github-actions"]' + RENOVATE_GIT_AUTHOR: Renovate GitHub Bot + RENOVATE_OPTIMIZE_FOR_DISABLED: 'true' + RENOVATE_PLATFORM: github + RENOVATE_REPOSITORIES: '["${{ github.repository }}"]' + RENOVATE_REPOSITORY_CACHE: enabled + RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }} + image: ghcr.io/renovatebot/renovate:37.202.2 + options: '--user root' + outputs: + tokenExists: ${{ steps.check_token.outputs.tokenExists }} + permissions: + contents: write + issues: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - run: env | sort + - run: | + if [ -z "${{ secrets.RENOVATE_TOKEN }}" ]; then + echo "RENOVATE_TOKEN not set, skipping ..." + else + renovate $RENOVATE_EXTRA_FLAG + fi +on: + push: + branches: + - xuan.hu/renovate + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '0 * * * 0,6' + workflow_dispatch: null diff --git a/.gitlab/workflows/ci.yml b/.gitlab/workflows/ci.yml index 191593f6..711de24d 100644 --- a/.gitlab/workflows/ci.yml +++ b/.gitlab/workflows/ci.yml @@ -16,7 +16,7 @@ ci: - '3.11' - '3.12' rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" - if: $CI_PIPELINE_SOURCE == 'merge_request_event' script: - make dev diff --git a/.gitlab/workflows/commitlint.yml b/.gitlab/workflows/commitlint.yml index 3f1c8f18..23367f53 100644 --- a/.gitlab/workflows/commitlint.yml +++ b/.gitlab/workflows/commitlint.yml @@ -4,7 +4,7 @@ commitlint: entrypoint: [""] interruptible: true rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" - if: $CI_PIPELINE_SOURCE == 'merge_request_event' script: - | diff --git a/.gitlab/workflows/devcontainer.yml b/.gitlab/workflows/devcontainer.yml index 4938a1a4..9be72847 100644 --- a/.gitlab/workflows/devcontainer.yml +++ b/.gitlab/workflows/devcontainer.yml @@ -11,7 +11,8 @@ dev-container-publish: rules: - changes: - .devcontainer/Dockerfile - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "web" script: - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} - docker context create builder diff --git a/.gitlab/workflows/renovate.yml b/.gitlab/workflows/renovate.yml new file mode 100644 index 00000000..dc172b1c --- /dev/null +++ b/.gitlab/workflows/renovate.yml @@ -0,0 +1,27 @@ +renovate: + cache: + key: ${CI_COMMIT_REF_SLUG}-renovate + paths: + - renovate/cache/renovate/repository/ + image: renovate/renovate:37.202.2 + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + script: + - | + if [ -z "$RENOVATE_TOKEN" ]; then + echo "RENOVATE_TOKEN not set, skipping ..." + else + renovate $RENOVATE_EXTRA_FLAG + fi + stage: build + variables: + LOG_LEVEL: debug + RENOVATE_BASE_DIR: $CI_PROJECT_DIR/renovate + RENOVATE_BRANCH_PREFIX: renovate-gitlab/ + RENOVATE_ENABLED_MANAGERS: '["pep621"]' + RENOVATE_ENDPOINT: $CI_API_V4_URL + RENOVATE_GIT_AUTHOR: Renovate GitLab Bot + RENOVATE_OPTIMIZE_FOR_DISABLED: 'true' + RENOVATE_PLATFORM: gitlab + RENOVATE_REPOSITORIES: '["$CI_PROJECT_PATH"]' + RENOVATE_REPOSITORY_CACHE: enabled diff --git a/.renovaterc.json b/.renovaterc.json new file mode 100644 index 00000000..2eb5c68b --- /dev/null +++ b/.renovaterc.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:best-practices" + ], + "ignorePaths": [ + "**/template/**" + ], + "lockFileMaintenance": { + "enabled": true, + "schedule": [ + "at any time" + ] + } +} diff --git a/.vscode/settings.json b/.vscode/settings.json index ef2700b9..85fc799c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -36,6 +36,7 @@ "maxdepth", "modindex", "mypy", + "ndjson", "noninteractive", "pathjoin", "pipenv", @@ -45,6 +46,7 @@ "pyproject", "pytest", "Quickstart", + "renovatebot", "setuptools", "softprops", "sphinxcontrib",