File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Release on Package Update
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ - main
8+ paths :
9+ - ' package.json'
10+
11+ jobs :
12+ release :
13+ runs-on : ubuntu-latest
14+ permissions :
15+ contents : write
16+ steps :
17+ - name : Checkout repository
18+ uses : actions/checkout@v4
19+
20+ - name : Extract version from package.json
21+ id : version
22+ run : |
23+ VERSION=$(jq -r '.version' package.json)
24+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
25+ echo "Extracted version: $VERSION"
26+
27+ - name : Check if release already exists
28+ id : check_release
29+ run : |
30+ VERSION=${{ steps.version.outputs.VERSION }}
31+ if gh release view "v$VERSION" > /dev/null 2>&1; then
32+ echo "EXISTS=true" >> $GITHUB_OUTPUT
33+ else
34+ echo "EXISTS=false" >> $GITHUB_OUTPUT
35+ fi
36+ env :
37+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
38+
39+ - name : Create Release
40+ if : steps.check_release.outputs.EXISTS == 'false'
41+ run : |
42+ VERSION=${{ steps.version.outputs.VERSION }}
43+ gh release create "v$VERSION" \
44+ --title "v$VERSION" \
45+ --notes "Release v$VERSION" \
46+ --latest
47+ env :
48+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments