From 18ae55eddb7ddc03d9363286c57a51784b770b81 Mon Sep 17 00:00:00 2001 From: John Boyes Date: Sun, 26 Apr 2020 08:15:38 +0700 Subject: [PATCH] Create a new release on every pull request merge 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. --- .github/workflows/check_semver_labels.yml | 21 +++++++++ .github/workflows/github_tag_and_release.yml | 46 ++++++++++++++++++++ .goreleaser.yml | 7 +++ 3 files changed, 74 insertions(+) create mode 100644 .github/workflows/check_semver_labels.yml create mode 100644 .github/workflows/github_tag_and_release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/check_semver_labels.yml b/.github/workflows/check_semver_labels.yml new file mode 100644 index 0000000..1fe797b --- /dev/null +++ b/.github/workflows/check_semver_labels.yml @@ -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 }} diff --git a/.github/workflows/github_tag_and_release.yml b/.github/workflows/github_tag_and_release.yml new file mode 100644 index 0000000..779a34d --- /dev/null +++ b/.github/workflows/github_tag_and_release.yml @@ -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/semver-release-action@v1.3.1 + 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 }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..f54c323 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,7 @@ +--- +project_name: label-checker +build: + skip: true +release: + github: + prerelease: auto