forked from redhat-developer/app-services-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (68 loc) · 2.21 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: goreleaser
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Check tag
id: check-tag
run: |
if [[ ${GITHUB_REF} =~ ^refs/tags/^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::set-output name=prerelease::false"
else
echo "::set-output name=prerelease::true"
fi
- id: set-version
uses: actions/github-script@v4
with:
script: |
const version = context.ref.replace(/^refs\/tags\//, '').replace(/^v/, '')
core.setOutput('version', version)
-
name: Install git-chglog
uses: craicoverflow/install-git-chglog@v1
-
name: Generate release notes
if: steps.check-tag.outputs.prerelease == 'false'
run: |
git-chglog -t .chglog/RELEASE.tpl.md $(git describe --tags $(git rev-parse HEAD)) > RELEASE_NOTES.md
- name: Print release notes
if: steps.check-tag.outputs.prerelease == 'false'
run: cat RELEASE_NOTES.md
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: steps.check-tag.outputs.prerelease == 'false'
with:
version: latest
args: release --rm-dist --release-notes=RELEASE_NOTES.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser on pre-release
uses: goreleaser/goreleaser-action@v2
if: steps.check-tag.outputs.prerelease == 'true'
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Guides of new version
if: steps.check-tag.outputs.prerelease == 'false'
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.APP_SERVICES_CI }}
repository: redhat-developer/app-services-guides
event-type: rhoas-cli-release
client-payload: '{"version": steps.set-version.outputs.version }'