Skip to content

Commit b36cf29

Browse files
authored
Merge pull request #1 from thunder/fix/add-release-action
Automate releases
2 parents 36c518a + 60d01e8 commit b36cf29

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- 'v*.*.*'
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
# Bump version on merging Pull Requests with specific labels.
16+
# (bump:major,bump:minor,bump:patch)
17+
- id: bumpr
18+
if: "!startsWith(github.ref, 'refs/tags/')"
19+
uses: haya14busa/action-bumpr@v1
20+
21+
# Update corresponding major and minor tag.
22+
# e.g. Update v1 and v1.2 when releasing v1.2.3
23+
- uses: haya14busa/action-update-semver@v1
24+
if: "!steps.bumpr.outputs.skip"
25+
with:
26+
tag: ${{ steps.bumpr.outputs.next_version }}
27+
28+
# Get tag name.
29+
- id: tag
30+
uses: haya14busa/action-cond@v1
31+
with:
32+
cond: "${{ startsWith(github.ref, 'refs/tags/') }}"
33+
if_true: ${{ github.ref }}
34+
if_false: ${{ steps.bumpr.outputs.next_version }}
35+
36+
# Create release.
37+
- uses: actions/create-release@v1
38+
if: "steps.tag.outputs.value != ''"
39+
env:
40+
# This token is provided by Actions, you do not need to create your own token
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
tag_name: ${{ steps.tag.outputs.value }}
44+
release_name: Release ${{ steps.tag.outputs.value }}
45+
body: ${{ steps.bumpr.outputs.message }}
46+
draft: false
47+
prerelease: false

0 commit comments

Comments
 (0)