Skip to content

Commit 4047392

Browse files
author
changfeng
committed
fix: ci skip the publish and github release job
1 parent d66578e commit 4047392

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,29 @@ jobs:
5252
- run: pnpm test
5353
if: runner.os != 'Linux'
5454

55+
set-git-tag:
56+
runs-on: ubuntu-latest
57+
outputs:
58+
GIT_TAG: ${{ steps.set-tag.outputs.GIT_TAG }}
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v3
62+
63+
- name: Set GIT_TAG
64+
id: set-tag
65+
run: |
66+
GIT_TAG=$(git describe --tags --abbrev=0)
67+
LATEST_COMMIT=$(git rev-list -n 1 $GIT_TAG)
68+
CURRENT_COMMIT=$(git rev-parse HEAD)
69+
if [ "$LATEST_COMMIT" = "$CURRENT_COMMIT" ]; then
70+
echo "::set-output name=GIT_TAG::${GIT_TAG}"
71+
else
72+
echo "::set-output name=GIT_TAG::"
73+
fi
74+
5575
publish:
56-
needs: test
57-
if: startsWith(github.ref, 'refs/tags/v')
76+
needs: [set-git-tag, test]
77+
if: startsWith(needs.set-git-tag.outputs.GIT_TAG, 'v')
5878
runs-on: ubuntu-latest
5979
steps:
6080
- name: Checkout
@@ -98,8 +118,8 @@ jobs:
98118
run: pnpm run publish:open-vsx -p ${{ secrets.OPEN_VSX_TOKEN }}
99119

100120
release:
101-
needs: publish
102-
if: startsWith(github.ref, 'refs/tags/v')
121+
needs: [set-git-tag, publish]
122+
if: startsWith(needs.set-git-tag.outputs.GIT_TAG, 'v')
103123
runs-on: ubuntu-latest
104124
steps:
105125
- uses: actions/checkout@v3

0 commit comments

Comments
 (0)