diff --git a/.copier-answers.yml b/.copier-answers.yml index 1cb5879..f2c6432 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,4 +1,4 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: v2.0.7 +_commit: v2.0.10 _src_path: gh:dafyddj/copier-bootstrap template_name: copier-packer-build diff --git a/.github/copier-renovate.json5 b/.github/copier-renovate.json5 new file mode 100644 index 0000000..beb1746 --- /dev/null +++ b/.github/copier-renovate.json5 @@ -0,0 +1,33 @@ +{ + "enabledManagers": [ + "custom.regex", + ], + "extends": [ + ":dependencyDashboard", + ], + "allowedPostUpgradeCommands": [ + "^git stash$", + "^copier update", + ], + "branchPrefix": "copier-renovate/", + "requireConfig": "ignored", + "customManagers": [ + { + "customType": "regex", + "fileMatch": ["^.copier-answers.yml$"], + "matchStrings": [ + "_commit: (?\\S+) # __copier_update_available \\S+\\n_src_path: gh:(?\\S+)\\n", + "_commit: (?\\S+) # __copier_update_pending (?\\S+)\\n_src_path: gh:(?\\S+)\\n", + ], + "autoReplaceStringTemplate": "_commit: {{#if currentDigest}}{{{currentDigest}}}{{else}}{{{currentValue}}}{{/if}} # __copier_update_pending {{{newValue}}}\n_src_path: gh:{{{depName}}}\n", + "datasourceTemplate": "github-tags", + }, + ], + "postUpgradeTasks": { + "commands": [ + "git stash", + "copier update --skip-answered --vcs-ref {{{newVersion}}}", + ], + "executionMode": "update", + }, +} diff --git a/.github/entrypoint.sh b/.github/entrypoint.sh new file mode 100755 index 0000000..d123b4a --- /dev/null +++ b/.github/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +install-apt python3.8-venv pipx + +runuser -u ubuntu pipx install copier + +exec runuser -u ubuntu renovate diff --git a/.github/renovate.json5 b/.github/renovate.json5 index a9b318a..03794dc 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -19,13 +19,25 @@ "fileMatch": ["^.copier-answers.yml$"], "matchStrings": [ "_commit: (?\\S+)\\n_src_path: gh:(?\\S+)\\n", + "_commit: (?\\S+) # __copier_update_available (?\\S+)\\n_src_path: gh:(?\\S+)\\n", "_commit: (?\\S+) # __copier_update_needed (?\\S+)\\n_src_path: gh:(?\\S+)\\n", ], "datasourceTemplate": "github-tags", - "autoReplaceStringTemplate": "_commit: {{#if currentDigest}}{{{currentDigest}}}{{else}}{{{currentValue}}}{{/if}} # __copier_update_needed {{{newValue}}}\n_src_path: gh:{{{depName}}}\n", + "autoReplaceStringTemplate": "_commit: {{#if currentDigest}}{{{currentDigest}}}{{else}}{{{currentValue}}}{{/if}} # __copier_update_available {{{newValue}}}\n_src_path: gh:{{{depName}}}\n", }, ], "git-submodules": { "enabled": true }, + "packageRules": [ + { + "matchManagers": ["git-submodules"], + "automerge": true, + }, + { + "matchManagers": ["custom.regex"], + "commitMessageSuffix": "available", + }, + ], + "platformAutomerge": false, } diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9dad00e..812d056 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,23 +10,36 @@ concurrency: cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: + should-run: + name: Should run + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + should-run: ${{ steps.action.outputs.should-run }} + steps: + - id: action + uses: techneg-it/should-workflow-run@dcbb88600d59ec2842778ef1e2d41f680f876329 # v1.0.0 pre-commit: name: Run `pre-commit` + needs: should-run + if: fromJSON(needs.should-run.outputs.should-run) runs-on: ubuntu-latest env: # renovate: datasource=github-releases depName=actions/python-versions extractVersion=^(?\S+)-\d+$ PYTHON_VERSION: 3.12.3 steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: ${{ env.PYTHON_VERSION }} - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 test: name: Run approval tests + needs: should-run + if: fromJSON(needs.should-run.outputs.should-run) runs-on: ubuntu-latest steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: fetch-depth: 0 # `copier` prefers full-history clones submodules: true @@ -50,7 +63,7 @@ jobs: contents: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - uses: codfish/semantic-release-action@b0e57c976bf8f74b2454f59a30e4a1b5f11727b4 # v3.3.0 with: plugins: | diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml new file mode 100644 index 0000000..aaaf6f8 --- /dev/null +++ b/.github/workflows/renovate.yml @@ -0,0 +1,27 @@ +--- +name: Self-hosted Renovate + +on: + workflow_dispatch: + +jobs: + renovate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/create-github-app-token@a0de6af83968303c8c955486bf9739a57d23c7f1 # v1.10.0 + id: app-token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.PRIVATE_KEY }} + - name: Self-hosted Renovate + uses: renovatebot/github-action@063e0c946b9c1af35ef3450efc44114925d6e8e6 # v40.1.11 + with: + configurationFile: .github/copier-renovate.json5 + docker-cmd-file: .github/entrypoint.sh + docker-user: root + token: ${{ steps.app-token.outputs.token }} + env: + LOG_LEVEL: debug + RENOVATE_DRY_RUN: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} + RENOVATE_REPOSITORIES: ${{ github.repository }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 452a06a..ac30bb7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: args: [--assume-in-merge] - id: check-yaml - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.3 + rev: 0.28.4 hooks: - id: check-github-workflows name: Check GitHub workflows with check-jsonschema diff --git a/template/.github/copier-renovate.json5 b/template/.github/copier-renovate.json5 new file mode 100644 index 0000000..beb1746 --- /dev/null +++ b/template/.github/copier-renovate.json5 @@ -0,0 +1,33 @@ +{ + "enabledManagers": [ + "custom.regex", + ], + "extends": [ + ":dependencyDashboard", + ], + "allowedPostUpgradeCommands": [ + "^git stash$", + "^copier update", + ], + "branchPrefix": "copier-renovate/", + "requireConfig": "ignored", + "customManagers": [ + { + "customType": "regex", + "fileMatch": ["^.copier-answers.yml$"], + "matchStrings": [ + "_commit: (?\\S+) # __copier_update_available \\S+\\n_src_path: gh:(?\\S+)\\n", + "_commit: (?\\S+) # __copier_update_pending (?\\S+)\\n_src_path: gh:(?\\S+)\\n", + ], + "autoReplaceStringTemplate": "_commit: {{#if currentDigest}}{{{currentDigest}}}{{else}}{{{currentValue}}}{{/if}} # __copier_update_pending {{{newValue}}}\n_src_path: gh:{{{depName}}}\n", + "datasourceTemplate": "github-tags", + }, + ], + "postUpgradeTasks": { + "commands": [ + "git stash", + "copier update --skip-answered --vcs-ref {{{newVersion}}}", + ], + "executionMode": "update", + }, +} diff --git a/template/.github/entrypoint.sh b/template/.github/entrypoint.sh new file mode 100755 index 0000000..d123b4a --- /dev/null +++ b/template/.github/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +install-apt python3.8-venv pipx + +runuser -u ubuntu pipx install copier + +exec runuser -u ubuntu renovate diff --git a/template/.github/renovate.json5 b/template/.github/renovate.json5 index a9b318a..03794dc 100644 --- a/template/.github/renovate.json5 +++ b/template/.github/renovate.json5 @@ -19,13 +19,25 @@ "fileMatch": ["^.copier-answers.yml$"], "matchStrings": [ "_commit: (?\\S+)\\n_src_path: gh:(?\\S+)\\n", + "_commit: (?\\S+) # __copier_update_available (?\\S+)\\n_src_path: gh:(?\\S+)\\n", "_commit: (?\\S+) # __copier_update_needed (?\\S+)\\n_src_path: gh:(?\\S+)\\n", ], "datasourceTemplate": "github-tags", - "autoReplaceStringTemplate": "_commit: {{#if currentDigest}}{{{currentDigest}}}{{else}}{{{currentValue}}}{{/if}} # __copier_update_needed {{{newValue}}}\n_src_path: gh:{{{depName}}}\n", + "autoReplaceStringTemplate": "_commit: {{#if currentDigest}}{{{currentDigest}}}{{else}}{{{currentValue}}}{{/if}} # __copier_update_available {{{newValue}}}\n_src_path: gh:{{{depName}}}\n", }, ], "git-submodules": { "enabled": true }, + "packageRules": [ + { + "matchManagers": ["git-submodules"], + "automerge": true, + }, + { + "matchManagers": ["custom.regex"], + "commitMessageSuffix": "available", + }, + ], + "platformAutomerge": false, } diff --git a/template/.github/workflows/renovate.yml b/template/.github/workflows/renovate.yml new file mode 100644 index 0000000..aaaf6f8 --- /dev/null +++ b/template/.github/workflows/renovate.yml @@ -0,0 +1,27 @@ +--- +name: Self-hosted Renovate + +on: + workflow_dispatch: + +jobs: + renovate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/create-github-app-token@a0de6af83968303c8c955486bf9739a57d23c7f1 # v1.10.0 + id: app-token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.PRIVATE_KEY }} + - name: Self-hosted Renovate + uses: renovatebot/github-action@063e0c946b9c1af35ef3450efc44114925d6e8e6 # v40.1.11 + with: + configurationFile: .github/copier-renovate.json5 + docker-cmd-file: .github/entrypoint.sh + docker-user: root + token: ${{ steps.app-token.outputs.token }} + env: + LOG_LEVEL: debug + RENOVATE_DRY_RUN: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} + RENOVATE_REPOSITORIES: ${{ github.repository }} diff --git a/test/GenerateProject/catalogue.tt b/test/GenerateProject/catalogue.tt index 7071954..7948938 100644 --- a/test/GenerateProject/catalogue.tt +++ b/test/GenerateProject/catalogue.tt @@ -2,9 +2,12 @@ The following new files/directories were created: ----.copier-answers.yml ----.github +--------copier-renovate.json5 +--------entrypoint.sh --------renovate.json5 --------workflows ------------libbuild.yml +------------renovate.yml ----.gitignore ----.pre-commit-config.yaml ----bin diff --git a/test/SetBoxName/catalogue.tt b/test/SetBoxName/catalogue.tt index 7071954..7948938 100644 --- a/test/SetBoxName/catalogue.tt +++ b/test/SetBoxName/catalogue.tt @@ -2,9 +2,12 @@ The following new files/directories were created: ----.copier-answers.yml ----.github +--------copier-renovate.json5 +--------entrypoint.sh --------renovate.json5 --------workflows ------------libbuild.yml +------------renovate.yml ----.gitignore ----.pre-commit-config.yaml ----bin