Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

cut releases on CI, when the version number in version.json is changed #222

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release Checker
on:
pull_request:
paths: [ 'version.json' ]
branches: [ master ]

jobs:
releaser:
runs-on: ubuntu-latest
env:
HIGHESTRELEASED: ""
VERSION: ""
GORELEASE: ""
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.16.x"
- name: Install gorelease
run: go install golang.org/x/exp/cmd/[email protected]
- name: Determine version
run: echo "VERSION=$(jq -r .version version.json)" >> $GITHUB_ENV
- name: Determine highest released version
run: echo "HIGHESTRELEASED=$(go list -m -versions | tr " " "\n" | tail -n 1)" >> $GITHUB_ENV
- name: Run gorelease
id: gorelease
if: env.VERSION != env.HIGHESTRELEASED
run: |
output=$(gorelease || true)
# dealing with multi-line strings in GitHub Actions is a pain
echo "GORELEASE<<EOF" >> $GITHUB_ENV
echo "$output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- uses: marocchino/sticky-pull-request-comment@v2
if: env.VERSION != env.HIGHESTRELEASED
with:
header: test
recreate: true
message: |
Most recent release is: ${{ env.HIGHESTRELEASED }}

`gorelease` says:
```
${{ env.GORELEASE }}
```
19 changes: 19 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Releaser
on:
push:
paths: [ 'version.json' ]
branches: [ master ]

jobs:
releaser:
runs-on: ubuntu-latest
env:
VERSION: ""
steps:
- uses: actions/checkout@v2
- name: Determine version
run: echo "VERSION=$(jq -r .version version.json)" >> $GITHUB_ENV
- name: Create release
run: |
git tag ${{ env.VERSION }}
git push --tags
3 changes: 3 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"version": "v0.11.2"
}