Skip to content

Commit

Permalink
Create a new release on every pull request merge (#1)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
johnboyes committed Jul 29, 2020
1 parent 1895bcf commit 01a15f2
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/check_semver_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Label Checker
on: # yamllint disable-line rule:truthy
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled

jobs:

check_semver_label:
name: Check for semantic version label
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
one_of: major,minor,patch
repo_token: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/github_tag_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tag

on:
pull_request:
types:
- closed

jobs:

tag:
name: Tag semantic version
runs-on: ubuntu-latest
steps:
- name: Tag
uses: K-Phoen/[email protected]
with:
release_branch: master
release_strategy: tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
needs: tag
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.14.x
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
key: ${{ secrets.YOUR_PRIVATE_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
project_name: label-checker
build:
skip: true
release:
github:
prerelease: auto

0 comments on commit 01a15f2

Please sign in to comment.