diff --git a/.github/labeler.yaml b/.github/labeler.yaml index 6661f2ae3..d103a7c13 100644 --- a/.github/labeler.yaml +++ b/.github/labeler.yaml @@ -1,9 +1,27 @@ --- +area/addons: + - changed-files: + - any-glob-to-any-file: bootstrap/templates/addons/**/* + - any-glob-to-any-file: bootstrap/tasks/addons/**/* + - any-glob-to-any-file: bootstrap/vars/addons.sample.yaml area/ansible: - - "ansible/**/*" + - changed-files: + - any-glob-to-any-file: ansible/**/* + - any-glob-to-any-file: bootstrap/templates/ansible/**/* + - any-glob-to-any-file: bootstrap/tasks/ansible/**/* +area/bootstrap: + - changed-files: + - any-glob-to-any-file: bootstrap/**/* + - any-glob-to-any-file: bootstrap/configure.yaml area/github: - - ".github/**/*" + - changed-files: + - any-glob-to-any-file: .github/**/* area/kubernetes: - - "kubernetes/**/*" -area/templates: - - "tmpl/**/*" + - changed-files: + - any-glob-to-any-file: kubernetes/**/* + - any-glob-to-any-file: bootstrap/templates/kubernetes/**/* + - any-glob-to-any-file: bootstrap/tasks/kubernetes/**/* +area/taskfile: + - changed-files: + - any-glob-to-any-file: .taskfiles/**/* + - any-glob-to-any-file: Taskfile* diff --git a/.github/labels.yaml b/.github/labels.yaml index 859905109..d55e4789c 100644 --- a/.github/labels.yaml +++ b/.github/labels.yaml @@ -1,53 +1,37 @@ --- # Area +- name: area/addons + color: "0e8a16" - name: area/ansible - color: "72ccf3" - description: >- - Changes made in the ansible directory + color: "0e8a16" +- name: area/bootstrap + color: "0e8a16" - name: area/github - color: "72ccf3" - description: >- - Changes made in the github directory + color: "0e8a16" - name: area/kubernetes - color: "72ccf3" - description: >- - Changes made in the kubernetes directory -- name: area/template - color: "72ccf3" - description: >- - Changes made in the tmpl directory + color: "0e8a16" +- name: area/taskfile + color: "0e8a16" # Renovate - name: renovate/ansible - color: "ffc300" + color: "027fa0" - name: renovate/container - color: "ffc300" + color: "027fa0" - name: renovate/github-action - color: "ffc300" + color: "027fa0" - name: renovate/github-release - color: "ffc300" + color: "027fa0" - name: renovate/helm - color: "ffc300" + color: "027fa0" # Semantic Type - name: type/patch - color: "FFEC19" + color: "ffec19" - name: type/minor - color: "FF9800" + color: "ff9800" - name: type/major - color: "F6412D" + color: "f6412d" - name: type/break - color: "F6412D" + color: "f6412d" # Uncategorized -- name: bug +- name: hold/upstream color: "ee0701" -- name: do-not-merge - color: "ee0701" -- name: docs - color: "F4D1B7" -- name: enhancement - color: "84b6eb" -- name: broken-links - color: "7B55D7" -- name: question - color: "cc317c" -- name: community - color: "0e8a16" diff --git a/.github/release-drafter.yaml b/.github/release-drafter.yaml deleted file mode 100644 index 0a235cd05..000000000 --- a/.github/release-drafter.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -name-template: "Release v$RESOLVED_VERSION" -tag-template: "v$RESOLVED_VERSION" -change-template: "- $TITLE @$AUTHOR (#$NUMBER)" -change-title-escapes: '\<*_&' -categories: - - title: "Community Contributions" - labels: ["community"] - - title: "Kubernetes" - labels: ["area/kubernetes"] - - title: "Github" - labels: ["area/github"] - - title: "Ansible" - labels: ["area/ansible"] - - title: "Maintenance" - labels: ["docs"] -version-resolver: - major: - labels: ["type/break"] - minor: - labels: ["type/major", "type/minor"] - patch: - labels: ["type/patch"] - default: patch -template: | - ## What's Changed - - $CHANGES - - **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION diff --git a/.github/release.yaml b/.github/release.yaml new file mode 100644 index 000000000..1598e66bf --- /dev/null +++ b/.github/release.yaml @@ -0,0 +1,4 @@ +changelog: + exclude: + authors: + - renovate diff --git a/.github/renovate.json5 b/.github/renovate.json5 index a6b9e572c..70bfe311f 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -6,43 +6,238 @@ ":disableRateLimiting", ":dependencyDashboard", ":semanticCommits", - ":automergeDigest", - ":automergeBranch", - "github>onedr0p/flux-cluster-template//.github/renovate/autoMerge.json5", - "github>onedr0p/flux-cluster-template//.github/renovate/commitMessage.json5", - "github>onedr0p/flux-cluster-template//.github/renovate/groups.json5", - "github>onedr0p/flux-cluster-template//.github/renovate/labels.json5", - "github>onedr0p/flux-cluster-template//.github/renovate/semanticCommits.json5", - "helpers:pinGitHubActionDigests" + ":automergeBranch" ], "dependencyDashboard": true, "dependencyDashboardTitle": "Renovate Dashboard 🤖", - "suppressNotifications": ["prIgnoreNotification"], + "suppressNotifications": ["prEditedNotification", "prIgnoreNotification"], "rebaseWhen": "conflicted", - "schedule": ["every saturday"], + "schedule": ["on saturday"], "flux": { - "fileMatch": ["kubernetes/.+\\.ya?ml$"] + "fileMatch": [ + "(^|/)addons/.+\\.ya?ml(\\.j2)?(\\.j2)?$", + "(^|/)ansible/.+\\.ya?ml(\\.j2)?(\\.j2)?$", + "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?(\\.j2)?$" + ] }, "helm-values": { - "fileMatch": ["kubernetes/.+\\.ya?ml$"] + "fileMatch": [ + "(^|/)addons/.+\\.ya?ml(\\.j2)?(\\.j2)?$", + "(^|/)ansible/.+\\.ya?ml(\\.j2)?(\\.j2)?$", + "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?(\\.j2)?$" + ] }, "kubernetes": { "fileMatch": [ - "ansible/.+\\.ya?ml(\\.j2)?$", - "kubernetes/.+\\.ya?ml$" + "(^|/)addons/.+\\.ya?ml(\\.j2)?(\\.j2)?$", + "(^|/)ansible/.+\\.ya?ml(\\.j2)?(\\.j2)?$", + "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?(\\.j2)?$" + ] + }, + "kustomize": { + "fileMatch": [ + "(^|/)kustomization\\.ya?ml(\\.j2)?$" ] }, - "regexManagers": [ + // commit message topics + "commitMessageTopic": "{{depName}}", + "commitMessageExtra": "to {{newVersion}}", + "commitMessageSuffix": "", + // package rules + "packageRules": [ + // automerge + { + "description": "Auto merge Github Actions", + "matchManagers": ["github-actions"], + "automerge": true, + "automergeType": "branch", + "ignoreTests": true, + "matchUpdateTypes": ["minor", "patch"] + }, + // groups + { + "description": "Flux Group", + "groupName": "Flux", + "matchPackagePatterns": ["flux"], + "matchDatasources": ["docker", "github-tags"], + "versioning": "semver", + "group": { + "commitMessageTopic": "{{{groupName}}} group" + }, + "separateMinorPatch": true + }, + { + "description": "System Upgrade Controller Group", + "groupName": "System Upgrade Controller", + "matchPackagePatterns": ["rancher/system-upgrade-controller"], + "matchDatasources": ["docker", "github-releases"], + "group": { + "commitMessageTopic": "{{{groupName}}} group" + }, + "separateMinorPatch": true + }, + // custom versioning + { + "description": "Use custom versioning for k3s", + "matchDatasources": ["github-releases"], + "versioning": "regex:^v(?\\d+)\\.(?\\d+)\\.(?\\d+)(?\\+k3s)(?\\d+)$", + "matchPackagePatterns": ["k3s"] + }, + // commit message topics + { + "matchDatasources": ["helm"], + "commitMessageTopic": "chart {{depName}}" + }, + { + "matchDatasources": ["docker"], + "commitMessageTopic": "image {{depName}}" + }, + // commit messages + { + "matchDatasources": ["docker"], + "matchUpdateTypes": ["major"], + "commitMessagePrefix": "feat(container)!: " + }, + { + "matchDatasources": ["docker"], + "matchUpdateTypes": ["minor"], + "semanticCommitType": "feat", + "semanticCommitScope": "container" + }, + { + "matchDatasources": ["docker"], + "matchUpdateTypes": ["patch"], + "semanticCommitType": "fix", + "semanticCommitScope": "container" + }, + { + "matchDatasources": ["docker"], + "matchUpdateTypes": ["digest"], + "semanticCommitType": "chore", + "semanticCommitScope": "container" + }, + { + "matchDatasources": ["helm"], + "matchUpdateTypes": ["major"], + "commitMessagePrefix": "feat(helm)!: " + }, + { + "matchDatasources": ["helm"], + "matchUpdateTypes": ["minor"], + "semanticCommitType": "feat", + "semanticCommitScope": "helm" + }, + { + "matchDatasources": ["helm"], + "matchUpdateTypes": ["patch"], + "semanticCommitType": "fix", + "semanticCommitScope": "helm" + }, + { + "matchDatasources": ["galaxy", "galaxy-collection"], + "matchUpdateTypes": ["major"], + "commitMessagePrefix": "feat(ansible)!: " + }, + { + "matchDatasources": ["galaxy", "galaxy-collection"], + "matchUpdateTypes": ["minor"], + "semanticCommitType": "feat", + "semanticCommitScope": "ansible" + }, + { + "matchDatasources": ["galaxy", "galaxy-collection"], + "matchUpdateTypes": ["patch"], + "semanticCommitType": "fix", + "semanticCommitScope": "ansible" + }, + { + "matchDatasources": ["github-releases", "github-tags"], + "matchUpdateTypes": ["major"], + "commitMessagePrefix": "feat(github-release)!: " + }, + { + "matchDatasources": ["github-releases", "github-tags"], + "matchUpdateTypes": ["minor"], + "semanticCommitType": "feat", + "semanticCommitScope": "github-release" + }, + { + "matchDatasources": ["github-releases", "github-tags"], + "matchUpdateTypes": ["patch"], + "semanticCommitType": "fix", + "semanticCommitScope": "github-release" + }, + { + "matchManagers": ["github-actions"], + "matchUpdateTypes": ["major"], + "commitMessagePrefix": "feat(github-action)!: " + }, + { + "matchManagers": ["github-actions"], + "matchUpdateTypes": ["minor"], + "semanticCommitType": "feat", + "semanticCommitScope": "github-action" + }, + { + "matchManagers": ["github-actions"], + "matchUpdateTypes": ["patch"], + "semanticCommitType": "fix", + "semanticCommitScope": "github-action" + }, + // labels + { + "matchUpdateTypes": ["major"], + "labels": ["type/major"] + }, + { + "matchUpdateTypes": ["minor"], + "labels": ["type/minor"] + }, + { + "matchUpdateTypes": ["patch"], + "labels": ["type/patch"] + }, + { + "matchDatasources": ["docker"], + "addLabels": ["renovate/container"] + }, + { + "matchDatasources": ["helm"], + "addLabels": ["renovate/helm"] + }, + { + "matchDatasources": ["galaxy", "galaxy-collection"], + "addLabels": ["renovate/ansible"] + }, + { + "matchDatasources": ["github-releases", "github-tags"], + "addLabels": ["renovate/github-release"] + }, + { + "matchManagers": ["github-actions"], + "addLabels": ["renovate/github-action"] + } + ], + // custom managers + "customManagers": [ { + "customType": "regex", "description": "Process various other dependencies", "fileMatch": [ - "ansible/.+\\.ya?ml(\\.j2)?$", - "kubernetes/.+\\.ya?ml$" + "(^|/)addons/.+\\.ya?ml(\\.j2)?(\\.j2)?$", + "(^|/)ansible/.+\\.ya?ml(\\.j2)?(\\.j2)?$", + "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?(\\.j2)?$" ], "matchStrings": [ - "datasource=(?\\S+) depName=(?\\S+)( registryUrl=(?\\S+))?\n.*?\"(?.*)\"\n" + // Example: `k3s_release_version: "v1.27.3+k3s1"` + "datasource=(?\\S+) depName=(?\\S+)( versioning=(?\\S+))?\n.*?\"(?.*)\"\n", + // Example: `- https://github.com/rancher/system-upgrade-controller/releases/download/v0.11.0/crd.yaml` + "datasource=(?\\S+) depName=(?\\S+)( versioning=(?\\S+))?\n.*?-\\s(.*?)\/(?[^/]+)\/[^/]+\n", + // Example: apiVersion=helm.cattle.io/v1 kind=HelmChart + "datasource=(?\\S+)\n.*?repo: (?\\S+)\n.*?chart: (?\\S+)\n.*?version: (?\\S+)\n" ], - "datasourceTemplate": "{{#if datasource}}{{{datasource}}}{{else}}github-releases{{/if}}" + "datasourceTemplate": "{{#if datasource}}{{{datasource}}}{{else}}github-releases{{/if}}", + "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}" } ] } diff --git a/.github/renovate/autoMerge.json5 b/.github/renovate/autoMerge.json5 deleted file mode 100644 index 8032cc200..000000000 --- a/.github/renovate/autoMerge.json5 +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "packageRules": [ - { - "description": "Auto merge GitHub Actions", - "matchManagers": ["github-actions"], - "automerge": true, - "automergeType": "branch", - "ignoreTests": true, - "matchUpdateTypes": ["minor", "patch", "digest"] - }, - { - "description": "Auto merge container digests", - "matchDatasources": ["docker"], - "automerge": true, - "automergeType": "branch", - "ignoreTests": true, - "matchUpdateTypes": ["digest"] - } - ] -} diff --git a/.github/renovate/commitMessage.json5 b/.github/renovate/commitMessage.json5 deleted file mode 100644 index 3fea62872..000000000 --- a/.github/renovate/commitMessage.json5 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "commitMessageTopic": "{{depName}}", - "commitMessageExtra": "to {{newVersion}}", - "commitMessageSuffix": "", - "packageRules": [ - { - "matchDatasources": ["helm"], - "commitMessageTopic": "chart {{depName}}" - }, - { - "matchDatasources": ["docker"], - "commitMessageTopic": "image {{depName}}" - } - ] -} diff --git a/.github/renovate/groups.json5 b/.github/renovate/groups.json5 deleted file mode 100644 index 98e4468d9..000000000 --- a/.github/renovate/groups.json5 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "packageRules": [ - { - "description": "Flux Group", - "groupName": "Flux", - "matchPackagePatterns": ["flux"], - "matchDatasources": ["docker", "github-tags"], - "versioning": "semver", - "group": { - "commitMessageTopic": "{{{groupName}}} group" - }, - "separateMinorPatch": true - } - ] -} diff --git a/.github/renovate/labels.json5 b/.github/renovate/labels.json5 deleted file mode 100644 index 494472cb6..000000000 --- a/.github/renovate/labels.json5 +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "packageRules": [ - { - "matchUpdateTypes": ["major"], - "labels": ["type/major"] - }, - { - "matchUpdateTypes": ["minor"], - "labels": ["type/minor"] - }, - { - "matchUpdateTypes": ["patch"], - "labels": ["type/patch"] - }, - { - "matchDatasources": ["docker"], - "addLabels": ["renovate/container"] - }, - { - "matchDatasources": ["helm"], - "addLabels": ["renovate/helm"] - }, - { - "matchDatasources": ["galaxy", "galaxy-collection"], - "addLabels": ["renovate/ansible"] - }, - { - "matchDatasources": ["github-releases", "github-tags"], - "addLabels": ["renovate/github-release"] - }, - { - "matchManagers": ["github-actions"], - "addLabels": ["renovate/github-action"] - } - ] -} diff --git a/.github/renovate/semanticCommits.json5 b/.github/renovate/semanticCommits.json5 deleted file mode 100644 index 614e44b39..000000000 --- a/.github/renovate/semanticCommits.json5 +++ /dev/null @@ -1,96 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "packageRules": [ - { - "matchDatasources": ["docker"], - "matchUpdateTypes": ["major"], - "commitMessagePrefix": "feat(container)!: " - }, - { - "matchDatasources": ["docker"], - "matchUpdateTypes": ["minor"], - "semanticCommitType": "feat", - "semanticCommitScope": "container" - }, - { - "matchDatasources": ["docker"], - "matchUpdateTypes": ["patch"], - "semanticCommitType": "fix", - "semanticCommitScope": "container" - }, - { - "matchDatasources": ["docker"], - "matchUpdateTypes": ["digest"], - "semanticCommitType": "chore", - "semanticCommitScope": "container" - }, - { - "matchDatasources": ["helm"], - "matchUpdateTypes": ["major"], - "commitMessagePrefix": "feat(helm)!: " - }, - { - "matchDatasources": ["helm"], - "matchUpdateTypes": ["minor"], - "semanticCommitType": "feat", - "semanticCommitScope": "helm" - }, - { - "matchDatasources": ["helm"], - "matchUpdateTypes": ["patch"], - "semanticCommitType": "fix", - "semanticCommitScope": "helm" - }, - { - "matchDatasources": ["galaxy", "galaxy-collection"], - "matchUpdateTypes": ["major"], - "commitMessagePrefix": "feat(ansible)!: " - }, - { - "matchDatasources": ["galaxy", "galaxy-collection"], - "matchUpdateTypes": ["minor"], - "semanticCommitType": "feat", - "semanticCommitScope": "ansible" - }, - { - "matchDatasources": ["galaxy", "galaxy-collection"], - "matchUpdateTypes": ["patch"], - "semanticCommitType": "fix", - "semanticCommitScope": "ansible" - }, - { - "matchDatasources": ["github-releases", "github-tags"], - "matchUpdateTypes": ["major"], - "commitMessagePrefix": "feat(github-release)!: " - }, - { - "matchDatasources": ["github-releases", "github-tags"], - "matchUpdateTypes": ["minor"], - "semanticCommitType": "feat", - "semanticCommitScope": "github-release" - }, - { - "matchDatasources": ["github-releases", "github-tags"], - "matchUpdateTypes": ["patch"], - "semanticCommitType": "fix", - "semanticCommitScope": "github-release" - }, - { - "matchManagers": ["github-actions"], - "matchUpdateTypes": ["major"], - "commitMessagePrefix": "feat(github-action)!: " - }, - { - "matchManagers": ["github-actions"], - "matchUpdateTypes": ["minor"], - "semanticCommitType": "feat", - "semanticCommitScope": "github-action" - }, - { - "matchManagers": ["github-actions"], - "matchUpdateTypes": ["patch"], - "semanticCommitType": "fix", - "semanticCommitScope": "github-action" - } - ] -} diff --git a/.github/workflows/flux-diff.yaml b/.github/workflows/flux-diff.yaml new file mode 100644 index 000000000..2d500bbe8 --- /dev/null +++ b/.github/workflows/flux-diff.yaml @@ -0,0 +1,67 @@ +--- +name: "Flux Diff" + +on: + pull_request: + branches: ["main"] + paths: ["kubernetes/**"] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +jobs: + flux-diff: + name: Flux Diff + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + strategy: + matrix: + paths: ["kubernetes"] + resources: ["helmrelease", "kustomization"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + path: pull + + - name: Checkout Default Branch + uses: actions/checkout@v4 + with: + ref: "${{ github.event.repository.default_branch }}" + path: default + + - name: Diff Resources + uses: docker://ghcr.io/allenporter/flux-local:main + with: + args: >- + diff ${{ matrix.resources }} + --unified 6 + --path /github/workspace/pull/${{ matrix.paths }} + --path-orig /github/workspace/default/${{ matrix.paths }} + --strip-attrs "helm.sh/chart,checksum/config,app.kubernetes.io/version,chart" + --limit-bytes 10000 + --all-namespaces + --sources "home-kubernetes" + --output-file diff.patch + + - name: Generate Diff + id: diff + run: | + cat diff.patch + echo "diff<> $GITHUB_OUTPUT + cat diff.patch >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - if: ${{ steps.diff.outputs.diff != '' }} + name: Add comment + uses: mshick/add-pr-comment@v2 + with: + message-id: "${{ github.event.pull_request.number }}/${{ matrix.paths }}/${{ matrix.resources }}" + message-failure: Diff was not successful + message: | + ```diff + ${{ steps.diff.outputs.diff }} + ``` diff --git a/.github/workflows/meta-sync-labels.yaml b/.github/workflows/label-sync.yaml similarity index 50% rename from .github/workflows/meta-sync-labels.yaml rename to .github/workflows/label-sync.yaml index 973eeab4e..c9b1c7eaf 100644 --- a/.github/workflows/meta-sync-labels.yaml +++ b/.github/workflows/label-sync.yaml @@ -1,5 +1,5 @@ --- -name: "Meta Sync labels" +name: "Label Sync" on: workflow_dispatch: @@ -8,16 +8,15 @@ on: paths: [".github/labels.yaml"] jobs: - labels: - name: Sync Labels + label-sync: + name: Label Sync runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@v4 - name: Sync Labels - uses: EndBug/label-sync@da00f2c11fdb78e4fae44adac2fdd713778ea3e8 # renovate: tag=v2.3.2 + uses: EndBug/label-sync@v2 with: config-file: .github/labels.yaml - token: "${{ secrets.GITHUB_TOKEN }}" delete-other-labels: true diff --git a/.github/workflows/labeler.yaml b/.github/workflows/labeler.yaml new file mode 100644 index 000000000..78fb12bf7 --- /dev/null +++ b/.github/workflows/labeler.yaml @@ -0,0 +1,20 @@ +--- +name: "Labeler" + +on: + workflow_dispatch: + pull_request_target: + branches: ["main"] + +jobs: + labeler: + name: Labeler + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Labeler + uses: actions/labeler@v5 + with: + configuration-path: .github/labeler.yaml diff --git a/.github/workflows/link-check.yaml b/.github/workflows/link-check.yaml deleted file mode 100644 index 9d58e1a53..000000000 --- a/.github/workflows/link-check.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: "Link Check" - -on: - workflow_dispatch: - schedule: - - cron: "0 0 * * 0" - -jobs: - link-check: - name: Link Check - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Link Checker - uses: lycheeverse/lychee-action@ec3ed119d4f44ad2673a7232460dc7dff59d2421 # v1.8.0 - id: lychee - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - - name: Find Link Checker Issue - id: link-checker-issue - uses: micalevisk/last-issue-action@f5661581217cc78cc282d1351aa65bd8bd155003 # v2.2.1 - with: - state: open - labels: | - broken-links - - - name: Update Issue - uses: peter-evans/create-issue-from-file@433e51abf769039ee20ba1293a088ca19d573b7f # renovate: tag=v4.0.1 - with: - title: Broken links detected 🔗 - issue-number: "${{ steps.link-checker-issue.outputs.issue-number }}" - content-filepath: ./lychee/out.md - token: "${{ secrets.GITHUB_TOKEN }}" - labels: | - broken-links diff --git a/.github/workflows/lychee.yaml b/.github/workflows/lychee.yaml new file mode 100644 index 000000000..5052aa550 --- /dev/null +++ b/.github/workflows/lychee.yaml @@ -0,0 +1,66 @@ +--- +name: "Lychee" + +on: + workflow_dispatch: + push: + branches: ["main"] + paths: [".github/workflows/lychee.yaml"] + schedule: + - cron: "0 0 * * *" + +env: + WORKFLOW_ISSUE_TITLE: "Link Checker Dashboard 🔗" + +jobs: + lychee: + name: Lychee + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Setup Workflow Tools + shell: bash + run: brew install lychee + + - name: Scan For Broken Links + shell: bash + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + run: | + lychee --verbose --no-progress \ + --format markdown \ + --output results.md \ + --exclude-all-private \ + --exclude-mail \ + ./**/*.md || true + + - name: Print Output + run: cat results.md + + - name: Find Link Checker Issue + id: find-issue + shell: bash + env: + GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + run: | + issue_number=$( \ + gh issue list \ + --search "in:title ${{ env.WORKFLOW_ISSUE_TITLE }}" \ + --state open \ + --json number \ + | jq --raw-output '.[0].number' \ + ) + echo "issue-number=${issue_number}" >> $GITHUB_OUTPUT + echo "${issue_number}" + + - name: Update Issue + uses: peter-evans/create-issue-from-file@v4 + with: + title: "${{ env.WORKFLOW_ISSUE_TITLE }}" + issue-number: "${{ steps.find-issue.outputs.issue-number || '' }}" + content-filepath: results.md diff --git a/.github/workflows/meta-labeler.yaml b/.github/workflows/meta-labeler.yaml deleted file mode 100644 index a5dac63ab..000000000 --- a/.github/workflows/meta-labeler.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: "Meta Labeler" - -on: - workflow_dispatch: - pull_request: - branches: ["main"] - -permissions: - checks: write - contents: read - pull-requests: write - -jobs: - labeler: - name: Labeler - runs-on: ubuntu-latest - steps: - - name: Labeler - uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # v4.3.0 - with: - configuration-path: .github/labeler.yaml - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release-drafter.yaml b/.github/workflows/release-drafter.yaml deleted file mode 100644 index d701f93a8..000000000 --- a/.github/workflows/release-drafter.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: "Draft Release" - -on: - workflow_dispatch: - push: - branches: ["main"] - -jobs: - update: - runs-on: ubuntu-latest - steps: - - uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5.25.0 - with: - config-name: release-drafter.yaml - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..ffc67c6c6 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,42 @@ +--- +name: "Release" + +on: + workflow_dispatch: + schedule: + - cron: "0 0 1 * *" + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create Release + shell: bash + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + run: | + # Retrieve previous release tag + previous_tag="$(gh release list --limit 1 | awk '{ print $1 }')" + previous_major="${previous_tag%%\.*}" + previous_minor="${previous_tag#*.}" + previous_minor="${previous_minor%.*}" + previous_patch="${previous_tag##*.}" + # Determine next release tag + next_major_minor="$(date +'%Y').$(date +'%-m')" + if [[ "${previous_major}.${previous_minor}" == "${next_major_minor}" ]]; then + echo "Month release already exists for year, incrementing patch number by 1" + next_patch="$((previous_patch + 1))" + else + echo "Month release does not exist for year, setting patch number to 0" + next_patch="0" + fi + # Create release + release_tag="${next_major_minor}.${next_patch}" + gh release create "${release_tag}" \ + --repo="${GITHUB_REPOSITORY}" \ + --title="${release_tag}" \ + --generate-notes