Skip to content

Commit 902dcb5

Browse files
committed
Add auto release flow
1 parent f20184b commit 902dcb5

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
on:
22
push:
3-
tags:
4-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
5-
6-
name: Create Release
3+
branches:
4+
- main
5+
paths:
6+
- "package.json"
77

8+
name: Create Release if version is bumped
89
jobs:
910
build:
1011
name: Create Release
1112
runs-on: ubuntu-latest
1213
steps:
1314
- name: Checkout code
1415
uses: actions/checkout@v2
16+
- run: git fetch --prune --unshallow --tags
17+
- uses: kanga333/config-value-exporter@main
18+
id: version
19+
with:
20+
key: version
21+
file: package.json
22+
- id: tag_check
23+
run: |
24+
git rev-parse ${{steps.version.outputs.result}} 2> /dev/null \
25+
|| echo '::set-output name=exist::false'
1526
- name: Create Release
27+
if: steps.tag_check.outputs.exist == 'false'
1628
id: create_release
1729
uses: actions/create-release@v1
1830
env:
1931
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2032
with:
21-
tag_name: ${{ github.ref }}
22-
release_name: Release ${{ github.ref }}
33+
tag_name: ${{steps.version.outputs.result}}
34+
release_name: Release ${{steps.version.outputs.result}}
2335
draft: false
2436
prerelease: false

0 commit comments

Comments
 (0)