diff --git a/.tools/semantic-release/.releaserc.yaml b/.tools/semantic-release/.releaserc.yaml new file mode 100644 index 0000000..1a68877 --- /dev/null +++ b/.tools/semantic-release/.releaserc.yaml @@ -0,0 +1,19 @@ +plugins: + - - "@semantic-release/commit-analyzer" + - preset: "conventionalcommits" + releaseRules: + # Given Go v2+ conventions we disable major releases on + # breaking changes and leave it up to the developer + # to make major releases + - breaking: true + release: "minor" + - "@semantic-release/release-notes-generator" + - "@semantic-release/github" + +branches: ["master"] +# github plugin is the only one running this step and we're not interested +# in its updates to PR and issues +success: false +# github plugin is the only one running this step and we're not interested +# the issues it creates due to failed releases +fail: false diff --git a/.tools/semantic-release/package.json b/.tools/semantic-release/package.json new file mode 100644 index 0000000..3069fdc --- /dev/null +++ b/.tools/semantic-release/package.json @@ -0,0 +1,8 @@ +{ + "devDependencies": { + "semantic-release": "^17.3.0", + "@semantic-release/github": "^7.2.0", + "@semantic-release/release-notes-generator": "^9.0.1", + "conventional-changelog-conventionalcommits": "^4.5.0" + } +} diff --git a/.tools/semantic-release/rules.mk b/.tools/semantic-release/rules.mk new file mode 100644 index 0000000..2992c1a --- /dev/null +++ b/.tools/semantic-release/rules.mk @@ -0,0 +1,12 @@ +semantic_release_cwd := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +semantic_release := $(semantic_release_cwd)/node_modules/.bin/semantic-release + +$(semantic_release): $(semantic_release_cwd)/package.json + $(info [semantic-release] installing packages...) + @cd $(semantic_release_cwd) && npm install --no-save --no-audit --ignore-scripts &> /dev/null + @touch $@ + +.PHONY: semantic-release +semantic-release: $(semantic_release_cwd)/.releaserc.yaml $(semantic_release) + $(info [$@] creating release...) + @cd $(semantic_release_cwd) && $(semantic_release) diff --git a/Makefile b/Makefile index 814baa5..6f77873 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +SHELL := /usr/bin/env bash + # all: run a complete build all: \ yaml-format \ @@ -14,6 +16,7 @@ include .tools/git-verify-nodiff/rules.mk include .tools/golangci-lint/rules.mk include .tools/prettier/rules.mk include .tools/goreview/rules.mk +include .tools/semantic-release/rules.mk .PHONY: go-test go-test: