Skip to content

Commit 0bd9433

Browse files
committed
👷 ci: skip tag creation for non-versioned commits
1 parent 71c68e1 commit 0bd9433

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/release.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/cache@v3
2424
with:
2525
path: node_modules
26-
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
26+
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
2727
restore-keys: |
2828
${{ runner.os }}-node-modules-
2929
@@ -35,17 +35,27 @@ jobs:
3535
run: npm run build
3636

3737
- name: Bump version and release
38+
id: semantic_release
3839
env:
3940
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
run: npx semantic-release
41+
run: |
42+
npx semantic-release | tee semantic_release_output.txt
43+
if grep -q "Published release" semantic_release_output.txt; then
44+
echo "NEW_VERSION_RELEASED=true" >> $GITHUB_ENV
45+
else
46+
echo "NEW_VERSION_RELEASED=false" >> $GITHUB_ENV
47+
fi
48+
continue-on-error: true
4149

4250
- name: Retrieve plugin version and name
51+
if: ${{ env.NEW_VERSION_RELEASED == 'true' }}
4352
id: get_version
4453
run: |
4554
echo "PLUGIN_VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
4655
echo "PLUGIN_NAME=$(node -p -e "require('./package.json').name")" >> $GITHUB_ENV
4756
4857
- name: Zip build files in a temporary directory
58+
if: ${{ env.NEW_VERSION_RELEASED == 'true' }}
4959
run: |
5060
mkdir -p /tmp/build
5161
mkdir -p /tmp/build/${PLUGIN_NAME}-${PLUGIN_VERSION}
@@ -54,6 +64,7 @@ jobs:
5464
zip -r ${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip ${PLUGIN_NAME}-${PLUGIN_VERSION}
5565
5666
- name: Create release and attach zip file
67+
if: ${{ env.NEW_VERSION_RELEASED == 'true' }}
5768
env:
5869
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5970
run: |

0 commit comments

Comments
 (0)