Skip to content

Commit 3597838

Browse files
committed
Release 0.2.1, generated from commit 0c706a5
1 parent a115546 commit 3597838

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'releases/*'
77

88
jobs:
9-
check:
9+
docker:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
@@ -31,11 +31,7 @@ jobs:
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' }}

0 commit comments

Comments
 (0)