Skip to content

Commit 01a15f2

Browse files
authored
Create a new release on every pull request merge (#1)
Using semantic versioning[1] Use GoReleaser[2] to create a new release every time a pull request is merged to master. This requires each pull request to have a semantic version label, which we enforce by using a label-checker GitHub Action[3]. [1] https://semver.org/ [2] https://goreleaser.com/ci/ [3] https://github.com/agilepathway/label-checker NB we don't build an executable when releasing, as this is not (currently, anyway) a Go project.
1 parent 1895bcf commit 01a15f2

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Label Checker
3+
on: # yamllint disable-line rule:truthy
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- labeled
10+
- unlabeled
11+
12+
jobs:
13+
14+
check_semver_label:
15+
name: Check for semantic version label
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: docker://agilepathway/pull-request-label-checker:latest
19+
with:
20+
one_of: major,minor,patch
21+
repo_token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Tag
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
jobs:
9+
10+
tag:
11+
name: Tag semantic version
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Tag
15+
uses: K-Phoen/[email protected]
16+
with:
17+
release_branch: master
18+
release_strategy: tag
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
release:
23+
needs: tag
24+
name: Create GitHub Release
25+
runs-on: ubuntu-latest
26+
steps:
27+
-
28+
name: Checkout
29+
uses: actions/checkout@v2
30+
-
31+
name: Unshallow
32+
run: git fetch --prune --unshallow
33+
-
34+
name: Set up Go
35+
uses: actions/setup-go@v1
36+
with:
37+
go-version: 1.14.x
38+
-
39+
name: Run GoReleaser
40+
uses: goreleaser/goreleaser-action@v1
41+
with:
42+
version: latest
43+
args: release --rm-dist
44+
key: ${{ secrets.YOUR_PRIVATE_KEY }}
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
project_name: label-checker
3+
build:
4+
skip: true
5+
release:
6+
github:
7+
prerelease: auto

0 commit comments

Comments
 (0)