Skip to content

Commit

Permalink
Merge pull request #2193 from traPtitech/renovate
Browse files Browse the repository at this point in the history
Dependabot -> Renovate
  • Loading branch information
logica0419 committed Jan 13, 2024
2 parents a979850 + 0061ea8 commit 111862f
Show file tree
Hide file tree
Showing 13 changed files with 336 additions and 22 deletions.
19 changes: 0 additions & 19 deletions .github/dependabot.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .github/renovate-bot.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"username": "trap-renovate[bot]",
"gitAuthor": "trap-renovate <138502363+trap-renovate[bot]@users.noreply.github.com>",
"repositories": ["traPtitech/traQ"]
}
26 changes: 26 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"docker:enableMajor",
":disableRateLimiting",
":dependencyDashboard",
":semanticCommits",
// ":automergeDigest",
// ":automergePatch", // no auto merge
"github>traPtitech/traQ//.github/renovate/auto-merge.json5",
"github>traPtitech/traQ//.github/renovate/commit-message.json5",
"github>traPtitech/traQ//.github/renovate/gomod.json5",
"github>traPtitech/traQ//.github/renovate/labels.json5",
"github>traPtitech/traQ//.github/renovate/regex-manager.json5",
"github>traPtitech/traQ//.github/renovate/semantic-commits.json5"
],
"platform": "github",
"platformAutomerge": true,
"onboarding": false,
"dependencyDashboardTitle": "Renovate Dashboard 🤖",
"suppressNotifications": ["prIgnoreNotification"],
"branchConcurrentLimit": 0,
"prHourlyLimit": 0,
"prConcurrentLimit": 0,
}
16 changes: 16 additions & 0 deletions .github/renovate/auto-merge.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"description": "Auto merge GitHub Actions",
"matchManagers": ["github-actions"],
"automerge": true,
},
{
"description": "Auto merge up to minor",
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "!/^0/",
"automerge": true
}
]
}
12 changes: 12 additions & 0 deletions .github/renovate/commit-message.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "to {{newVersion}}",
"commitMessageSuffix": "",
"packageRules": [
{
"matchDatasources": ["docker"],
"commitMessageTopic": "image {{depName}}"
}
]
}
14 changes: 14 additions & 0 deletions .github/renovate/gomod.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"matchManagers": ["gomod"],
"matchDepTypes": ["indirect"],
"enabled": true
},
{
"matchManagers": ["gomod"],
"postUpdateOptions": ["gomodTidy", "gomodMassage"]
}
]
}
37 changes: 37 additions & 0 deletions .github/renovate/labels.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"matchUpdateTypes": ["major"],
"labels": ["type/major"]
},
{
"matchUpdateTypes": ["minor"],
"labels": ["type/minor"]
},
{
"matchUpdateTypes": ["patch"],
"labels": ["type/patch"]
},
{
"matchUpdateTypes": ["digest"],
"labels": ["type/digest"]
},
{
"matchDatasources": ["docker"],
"addLabels": ["renovate/container"]
},
{
"matchDatasources": ["gomod"],
"addLabels": ["renovate/gomod"]
},
{
"matchDatasources": ["github-releases", "github-tags"],
"addLabels": ["renovate/github-releases"]
},
{
"matchManagers": ["github-actions"],
"addLabels": ["renovate/github-actions"]
}
]
}
63 changes: 63 additions & 0 deletions .github/renovate/regex-manager.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"customManagers": [
{
"description": "Custom dependencies",
"fileMatch": [
".+\\.ya?ml$"
],
"matchStrings": [
// Example: (github-releases) version: "v1.27.3"
"# renovate:general datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)\n.*?\"(?<currentValue>.*)\"\n",
// Example: (helm) targetRevision: "6.11.5"
"# renovate:general datasource=(?<datasource>\\S+) depName=(?<depName>\\S+) registryUrl=(?<registryUrl>\\S+)\n.*?\"(?<currentValue>.*)\"\n",
],
"datasourceTemplate": "{{#if datasource}}{{{datasource}}}{{else}}github-releases{{/if}}",
},
{
"description": "OCI image dependencies (full)",
"fileMatch": [
".+\\.ya?ml$"
],
"matchStrings": [
// Example:
// # renovate:image-full
// fooImage: "ghcr.io/motoki317/k8s-csi-s3:0.35.5-p1"
"# renovate:image-full\n.*?\"(?<registryUrl>[^\\s/]+)/(?<depName>[^\\s:]+):(?<currentValue>.+)\"\n",
],
"datasourceTemplate": "docker",
"registryUrlTemplate": "https://{{{registryUrl}}}",
"depNameTemplate": "{{{registryUrl}}}/{{{depName}}}",
},
{
"description": "OCI image dependencies (tag)",
"fileMatch": [
".+\\.ya?ml$"
],
"matchStrings": [
// Example:
// # renovate:image-tag imageName=ghcr.io/traptitech/traq
// fooTag: "0.35.5-p1"
"# renovate:image-tag imageName=(?<registryUrl>[^\\s/]+)/(?<depName>\\S+)\n.*?\"(?<currentValue>.+)\"\n",
],
"datasourceTemplate": "docker",
"registryUrlTemplate": "https://{{{registryUrl}}}",
"depNameTemplate": "{{{registryUrl}}}/{{{depName}}}"
},
{
"description": "GitHub URL dependencies",
"fileMatch": [
".+\\.ya?ml$"
],
"matchStrings": [
// Example: kustomize build https://github.com/argoproj/argo-cd//manifests/crds?ref=v2.7.6 | kubectl create -f -
"# renovate:github-url\n.*?https://github\\.com/(?<depName>[^/]+/[^/]+)//.*?\\?ref=(?<currentValue>\\S+)",
// Example: - https://raw.githubusercontent.com/traefik/traefik/v2.10.3/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml
"# renovate:github-url\n.*?https://raw\\.githubusercontent\\.com/(?<depName>[^/]+/[^/]+)/(?<currentValue>[^/]+)",
// Example: - https://github.com/rancher/system-upgrade-controller/releases/download/v0.11.0/crd.yaml
"# renovate:github-url\n.*?https://github\\.com/(?<depName>[^/]+/[^/]+)/releases/download/(?<currentValue>[^/]+)"
],
"datasourceTemplate": "github-releases",
}
]
}
85 changes: 85 additions & 0 deletions .github/renovate/semantic-commits.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"matchDatasources": ["gomod"],
"matchUpdateTypes": ["major"],
"commitMessagePrefix": "feat(gomod)!: "
},
{
"matchDatasources": ["gomod"],
"matchUpdateTypes": ["minor"],
"semanticCommitType": "feat",
"semanticCommitScope": "gomod"
},
{
"matchDatasources": ["gomod"],
"matchUpdateTypes": ["patch"],
"semanticCommitType": "fix",
"semanticCommitScope": "gomod"
},
{
"matchDatasources": ["gomod"],
"matchUpdateTypes": ["digest"],
"semanticCommitType": "chore",
"semanticCommitScope": "gomod"
},
{
"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": ["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"
}
]
}
19 changes: 19 additions & 0 deletions .github/workflows/renovate-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Renovate Auto Merge

on:
pull_request:

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'trap-renovate[bot]' }}
steps:
- name: Approve Renovate PRs
run: |
gh pr review --approve ${{github.event.pull_request.html_url}}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
54 changes: 54 additions & 0 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Renovate

on:
workflow_dispatch:
inputs:
dryRun:
description: Dry-Run
default: "false"
required: false
logLevel:
description: Log-Level
default: debug
required: false
schedule:
# 5 a.m. in JST(+9)
- cron: "0 20 * * *"
push:
branches: ["main"]
paths:
- .github/renovate-bot.json5
- .github/renovate.json5
- .github/renovate/**.json5
- .github/workflows/renovate.json

env:
LOG_LEVEL: debug
RENOVATE_DRY_RUN: false
RENOVATE_CONFIG_FILE: .github/renovate-bot.json5

jobs:
renovate:
name: Renovate
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PUSHER_APP_ID }}
private-key: ${{ secrets.PUSHER_PRIVATE_KEY }}
- uses: actions/checkout@v4
- name: Override default config from dispatch variables
shell: bash
run: |
echo "RENOVATE_DRY_RUN=${{ github.event.inputs.dryRun || env.RENOVATE_DRY_RUN }}" >> "${GITHUB_ENV}"
echo "LOG_LEVEL=${{ github.event.inputs.logLevel || env.LOG_LEVEL }}" >> "${GITHUB_ENV}"
- name: Renovate
uses: renovatebot/github-action@v39.2.4
with:
renovate-image: "ghcr.io/renovatebot/renovate"
# renovate:image-tag imageName=ghcr.io/renovatebot/renovate
renovate-version: "37.130.0"
configurationFile: "${{ env.RENOVATE_CONFIG_FILE }}"
token: "${{ steps.generate-token.outputs.token }}"
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ goreleaser-snapshot: ## Release dry-run
.PHONY: update-frontend
update-frontend: ## Update frontend files in dev/frontend
@mkdir -p ./dev/frontend
@curl -L -Ss https://github.com/traPtitech/traQ_S-UI/releases/latest/download/dist.tar.gz | tar zxv -C ./dev/frontend/ --strip-components=2
# renovate:github-url
@curl -L -Ss https://github.com/traPtitech/traQ_S-UI/releases/download/v3.18.2/dist.tar.gz | tar zxv -C ./dev/frontend/ --strip-components=2

.PHONY: reset-frontend
reset-frontend: ## Completely replace frontend files in dev/frontend
Expand Down
4 changes: 2 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
- app:/app/storage

frontend:
image: caddy:latest
image: caddy:2.7.5-alpine
restart: always
expose:
- "80"
Expand Down Expand Up @@ -94,7 +94,7 @@ services:
- "3001:8080"

botdebugger:
image: golang:alpine
image: golang:1.21.5-alpine
restart: always
volumes:
- ./dev/bin:/app
Expand Down

0 comments on commit 111862f

Please sign in to comment.