Skip to content

Commit 652ce4b

Browse files
committed
Add bump-minor workflow
1 parent 91ccba2 commit 652ce4b

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.github/workflows/bump-minor.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Bump minor version
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
ssh-key: "${{ secrets.PUSH_TAG_PRIVATE_KEY }}"
12+
13+
- name: Bump version
14+
run: |
15+
git fetch --tags
16+
# This suppress an error occurred when the repository is a complete one.
17+
git fetch --prune --unshallow || true
18+
19+
# Get a latest tag in the shape of semver.
20+
latest_tag=''
21+
for ref in $(git for-each-ref --sort=-creatordate --format '%(refname)' refs/tags); do
22+
tag="${ref#refs/tags/}"
23+
if echo "${tag}" | grep -Eq '^v?([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$'; then
24+
latest_tag="${tag}"
25+
break
26+
fi
27+
done
28+
29+
if [ "${latest_tag}" = '' ]; then
30+
latest_tag="v0.0.0"
31+
fi
32+
33+
# bump version
34+
npm install -g semver
35+
new_tag=v$(semver $latest_tag -i minor)
36+
echo "::debug::New tag is $new_tag"
37+
38+
# push new tag
39+
git config user.name "${GITHUB_ACTOR}"
40+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
41+
git tag -a $new_tag -m "$new_tag"
42+
git push origin $new_tag

.goreleaser.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
builds:
2+
- skip: true
3+
changelog:
4+
sort: asc
5+
filters:
6+
exclude:
7+
- '^docs:'
8+
- '^test:'

0 commit comments

Comments
 (0)