File tree Expand file tree Collapse file tree 1 file changed +26
-8
lines changed
Expand file tree Collapse file tree 1 file changed +26
-8
lines changed Original file line number Diff line number Diff line change 66 - ' releases/*'
77
88jobs :
9- check :
9+ docker :
1010 runs-on : ubuntu-latest
1111 steps :
1212 - name : Checkout
3131 else
3232 echo "create_release=yes" >> $GITHUB_ENV
3333 fi
34- docker :
35- needs :
36- - check
37- runs-on : ubuntu-latest
38- steps :
34+
3935 - name : Docker meta
4036 if : ${{ env.create_release == 'yes' }}
4137 id : meta
@@ -94,10 +90,32 @@ jobs:
9490 labels : ${{ steps.meta.outputs.labels }}
9591
9692 action :
97- needs :
98- - check
9993 runs-on : ubuntu-latest
94+ needs : docker
10095 steps :
96+ - name : Checkout
97+ uses : actions/checkout@v2
98+ with :
99+ fetch-depth : 0
100+
101+ - name : Check if tag already exists
102+ run : |
103+ # Get version from package.json (head is needed because this also returns "version" npm script line)
104+ sed -n '/version/s/,*\r*$//p' package.json | cut -d ':' -f2,3 | sed -e 's/^ "//' -e 's/"$//' | head -n 1 > app_version.tmp
105+ cat app_version.tmp | cut -d. -f1 > major_version.tmp
106+
107+ export VERSION_TAG="v$(cat app_version.tmp)"
108+ echo "package_version=$(cat app_version.tmp)" >> $GITHUB_ENV
109+ echo "major_version=$(cat major_version.tmp)" >> $GITHUB_ENV
110+
111+ # Check if tag already exists
112+ if [ $(git tag -l "$VERSION_TAG") ]; then
113+ echo "Tag already exists, please increment version to create release"
114+ echo "create_release=no" >> $GITHUB_ENV
115+ else
116+ echo "create_release=yes" >> $GITHUB_ENV
117+ fi
118+
101119 - name : 🚀 Release
102120 uses : softprops/action-gh-release@master
103121 if : ${{ env.create_release == 'yes' }}
You can’t perform that action at this time.
0 commit comments