Skip to content

Commit

Permalink
build: add semantic-release
Browse files Browse the repository at this point in the history
  • Loading branch information
odsod committed Dec 6, 2021
1 parent 4a629ee commit ff7cc75
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .tools/semantic-release/.releaserc.yaml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .tools/semantic-release/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
12 changes: 12 additions & 0 deletions .tools/semantic-release/rules.mk
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SHELL := /usr/bin/env bash

# all: run a complete build
all: \
yaml-format \
Expand All @@ -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:
Expand Down

0 comments on commit ff7cc75

Please sign in to comment.