Skip to content

Commit

Permalink
feat: integrate semantic releases
Browse files Browse the repository at this point in the history
  • Loading branch information
tboerger committed May 11, 2023
1 parent 2399e69 commit 0adeb84
Show file tree
Hide file tree
Showing 10 changed files with 290 additions and 30 deletions.
52 changes: 33 additions & 19 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,30 @@
":semanticCommitType(deps)",
":automergeMinor"
],
"regexManagers": [{
"fileMatch": [
"Dockerfile"
],
"matchStrings": [
"# renovate: datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( versioning=(?<versioning>.*?))?\nENV .*?_VERSION=(?<currentValue>.*)"
],
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
}],
"packageRules": [{
"regexManagers": [
{
"fileMatch": [
"Dockerfile"
],
"matchStrings": [
"# renovate: datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( versioning=(?<versioning>.*?))?\nENV .*?_VERSION=(?<currentValue>.*)"
],
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
}
],
"packageRules": [
{
"description": "Strip prefix from kustomize",
"groupName": "version prefix",
"matchDatasources": [
"github-releases"
],
"packageNames": [
"kubernetes-sigs/kustomize"
],
"extractVersion": "^kustomize\\/v(?<version>\\d+\\.\\d+\\.\\d+)$"
},
{
"description": "Strip v prefix from versions",
"groupName": "version prefix",
"matchDatasources": [
Expand All @@ -32,8 +46,8 @@
"minor",
"patch"
],
"semanticCommitType": "deps",
"semanticCommitScope": "minor",
"semanticCommitType": "minor",
"semanticCommitScope": "deps",
"automerge": true
},
{
Expand All @@ -45,8 +59,8 @@
"matchUpdateTypes": [
"major"
],
"semanticCommitType": "deps",
"semanticCommitScope": "major",
"semanticCommitType": "major",
"semanticCommitScope": "deps",
"automerge": true
},
{
Expand All @@ -58,8 +72,8 @@
"matchUpdateTypes": [
"minor"
],
"semanticCommitType": "deps",
"semanticCommitScope": "minor",
"semanticCommitType": "minor",
"semanticCommitScope": "deps",
"automerge": true
},
{
Expand All @@ -71,12 +85,12 @@
"matchUpdateTypes": [
"patch"
],
"semanticCommitType": "deps",
"semanticCommitScope": "patch",
"semanticCommitType": "patch",
"semanticCommitScope": "deps",
"automerge": true
}
],
"labels": [
"renovate"
]
}
}
23 changes: 23 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
commitsOnly: true
anyCommit: true
allowMergeCommits: true
allowRevertCommits: true

types:
- feat
- fix
- docs
- style
- refactor
- perf
- test
- build
- ci
- chore
- revert
- major
- minor
- patch

...
25 changes: 16 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
name: docker

'on':
push:
branches:
- v1
"on":
pull_request:
branches:
- v1
- master
push:
branches:
- master
tags:
- v*

jobs:
publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Checkout source
Expand All @@ -27,10 +29,10 @@ jobs:
flavor: |
latest=true
tags: |
type=ref,enable=true,event=branch
type=ref,enable=true,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
labels: |
org.opencontainers.image.vendor=Webhippie
maintainer=Thomas Boerger <thomas@webhippie.de>
Expand Down Expand Up @@ -62,4 +64,9 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}

- name: Update version
id: version
uses: nowactions/update-majorver@v1
if: startsWith(github.ref, 'refs/tags/v')

...
23 changes: 23 additions & 0 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: lock

"on":
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

permissions:
issues: write
pull-requests: write

concurrency:
group: lock

jobs:
execute:
runs-on: ubuntu-latest

steps:
- uses: dessant/lock-threads@v4

...
31 changes: 31 additions & 0 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: react

"on":
issue_comment:
types:
- created
- edited
pull_request_review_comment:
types:
- created
- edited
schedule:
- cron: "0 0 * * *"

permissions:
actions: write
issues: write
pull-requests: write

concurrency:
group: react

jobs:
execute:
runs-on: ubuntu-latest

steps:
- uses: dessant/reaction-comments@v3

...
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: release

"on":
schedule:
- cron: "0 8 * * 1"
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_ACCESS_TOKEN }}

- name: Semantic release
uses: cycjimmy/semantic-release-action@v3
env:
GITHUB_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}
with:
extra_plugins: |
@semantic-release/exec
conventional-changelog-conventionalcommits
...
117 changes: 117 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"branches": [
"master"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"type": "major",
"release": "major"
},
{
"type": "deps",
"scope": "major",
"release": "major"
},
{
"type": "minor",
"release": "minor"
},
{
"type": "deps",
"scope": "minor",
"release": "minor"
},
{
"type": "patch",
"release": "patch"
},
{
"type": "deps",
"scope": "patch",
"release": "patch"
},
{
"type": "refactor",
"release": "minor"
},
{
"scope": "docs",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "major",
"section": "Features"
},
{
"type": "minor",
"section": "Features"
},
{
"type": "fix",
"section": "Bugfixes"
},
{
"type": "patch",
"section": "Bugfixes"
},
{
"type": "chore",
"hidden": true
},
{
"type": "docs",
"hidden": true
},
{
"type": "refactor",
"hidden": true
}
]
}
}
],
[
"@semantic-release/changelog",
{
"changelogTitle": "# Changelog"
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "./hack/action-version.sh ${nextRelease.version}"
}
],
[
"@semantic-release/git",
{
"message": "chore: release ${nextRelease.version}",
"assets": ["CHANGELOG.md", "action.yml"]
}
],
[
"@semantic-release/github",
{
"addReleases": true
}
]
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# yamllint

[![Current Tag](https://img.shields.io/github/v/tag/actionhippie/yamllint?sort=semver)](https://github.com/actionhippie/yamllint) [![Docker Build](https://github.com/actionhippie/yamllint/workflows/docker/badge.svg)](https://github.com/actionhippie/yamllint/actions?query=workflow%3Adocker)
[![Current Tag](https://img.shields.io/github/v/tag/actionhippie/yamllint?sort=semver)](https://github.com/actionhippie/yamllint) [![Docker Build](https://github.com/actionhippie/yamllint/workflows/docker/badge.svg)](https://github.com/actionhippie/yamllint/actions/workflows/docker.yml)

[GitHub Action](https://github.com/features/actions) to validate/lint YAML files.

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ outputs:

runs:
using: 'docker'
image: 'docker://ghcr.io/actionhippie/yamllint:v1'
image: 'docker://ghcr.io/actionhippie/yamllint:latest'

...

0 comments on commit 0adeb84

Please sign in to comment.