Skip to content

Commit ae7cdab

Browse files
Merge pull request #197 from zendesk/sheen/veg-1208-sematic-release
[VEG-1208] add release action
2 parents a341aa7 + 6d5be19 commit ae7cdab

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Describe the original problem and the changes made on this PR.
99
- [ ] Include comments/inline docs where appropriate
1010
- [ ] Add [unit tests](/spec)
1111
- [ ] Update changelog [here](https://github.com/zendesk/zaf_docs/blob/master/doc/v2/dev_guide/changelog.md)
12+
- [ ] Add label from one of 'patch'/'minor'/'major' if you want to create a release when merged
1213

1314
### References
1415
* JIRA: https://zendesk.atlassian.net/browse/VEG-XXX

.github/workflows/release.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
patch-release:
9+
name: Create Patch Release
10+
if: (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'patch') )
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Check out the `master` branch
14+
- uses: zendesk/checkout@v3
15+
# Compute the next semantic version
16+
- name: Compute release tag
17+
id: compute_tag
18+
uses: zendesk/compute-tag@v10
19+
with:
20+
github_token: ${{ github.token }}
21+
version_scheme: semantic
22+
version_type: patch
23+
# Create a new GitHub release
24+
- name: Create release
25+
id: create_release
26+
uses: zendesk/[email protected]
27+
with:
28+
tag_name: ${{ steps.compute_tag.outputs.next_tag }}
29+
release_name: ${{ steps.compute_tag.outputs.next_tag }}
30+
commitish: ${{ github.git_ref }}
31+
body: |
32+
See [changes since last release](https://github.com/${{ github.repository }}/compare/${{ steps.compute_tag.outputs.previous_tag }}..${{ steps.compute_tag.outputs.next_tag }}) for full release details.
33+
prerelease: false
34+
draft: false
35+
env:
36+
GITHUB_TOKEN: ${{ github.token }}
37+
minor-release:
38+
name: Create Minor Release
39+
runs-on: ubuntu-latest
40+
# only run this job on a merge to master and with the corresponding sem ver label
41+
if: (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'minor') )
42+
steps:
43+
# Check out the `master` branch
44+
- uses: zendesk/checkout@v3
45+
# Compute the next semantic version
46+
- name: Compute release tag
47+
id: compute_tag
48+
uses: zendesk/compute-tag@v10
49+
with:
50+
github_token: ${{ github.token }}
51+
version_scheme: semantic
52+
version_type: minor
53+
# Create a new GitHub release
54+
- name: Create release
55+
id: create_release
56+
uses: zendesk/[email protected]
57+
with:
58+
tag_name: ${{ steps.compute_tag.outputs.next_tag }}
59+
release_name: ${{ steps.compute_tag.outputs.next_tag }}
60+
commitish: ${{ github.git_ref }}
61+
body: |
62+
See [changes since last release](https://github.com/${{ github.repository }}/compare/${{ steps.compute_tag.outputs.previous_tag }}..${{ steps.compute_tag.outputs.next_tag }}) for full release details.
63+
prerelease: false
64+
draft: false
65+
env:
66+
GITHUB_TOKEN: ${{ github.token }}
67+
major-release:
68+
name: Create Major Release
69+
runs-on: ubuntu-latest
70+
# only run this job on a merge to master and with the corresponding sem ver label
71+
if: (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'major') )
72+
steps:
73+
# Check out the `master` branch
74+
- uses: zendesk/checkout@v3
75+
# Compute the next semantic version
76+
- name: Compute release tag
77+
id: compute_tag
78+
uses: zendesk/compute-tag@v10
79+
with:
80+
github_token: ${{ github.token }}
81+
version_scheme: semantic
82+
version_type: major
83+
# Create a new GitHub release
84+
- name: Create release
85+
id: create_release
86+
uses: zendesk/[email protected]
87+
with:
88+
tag_name: ${{ steps.compute_tag.outputs.next_tag }}
89+
release_name: ${{ steps.compute_tag.outputs.next_tag }}
90+
commitish: ${{ github.git_ref }}
91+
body: |
92+
See [changes since last release](https://github.com/${{ github.repository }}/compare/${{ steps.compute_tag.outputs.previous_tag }}..${{ steps.compute_tag.outputs.next_tag }}) for full release details.
93+
prerelease: false
94+
draft: false
95+
env:
96+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)