Spaces:
Running
Running
add if conditions in workflow
Browse files
.github/workflows/release.yaml
CHANGED
@@ -41,11 +41,14 @@ jobs:
|
|
41 |
run: |
|
42 |
if git ls-remote --tags origin | grep "refs/tags/v${{ env.VERSION }}"; then
|
43 |
echo "Tag v${{ env.VERSION }} already exists on remote."
|
44 |
-
|
|
|
|
|
45 |
fi
|
46 |
|
47 |
# Step 6: Create and push a new tag (if it doesn't exist)
|
48 |
- name: Create Git tag
|
|
|
49 |
run: |
|
50 |
git config --global user.name "github-actions[bot]"
|
51 |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
@@ -54,6 +57,7 @@ jobs:
|
|
54 |
|
55 |
# Step 7: Create GitHub release (if tag didn't exist)
|
56 |
- name: Create GitHub Release
|
|
|
57 |
uses: softprops/action-gh-release@v1
|
58 |
with:
|
59 |
tag_name: "v${{ env.VERSION }}"
|
|
|
41 |
run: |
|
42 |
if git ls-remote --tags origin | grep "refs/tags/v${{ env.VERSION }}"; then
|
43 |
echo "Tag v${{ env.VERSION }} already exists on remote."
|
44 |
+
echo "tag_exists=true" >> $GITHUB_ENV
|
45 |
+
else
|
46 |
+
echo "tag_exists=false" >> $GITHUB_ENV
|
47 |
fi
|
48 |
|
49 |
# Step 6: Create and push a new tag (if it doesn't exist)
|
50 |
- name: Create Git tag
|
51 |
+
if: env.tag_exists == 'false'
|
52 |
run: |
|
53 |
git config --global user.name "github-actions[bot]"
|
54 |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
57 |
|
58 |
# Step 7: Create GitHub release (if tag didn't exist)
|
59 |
- name: Create GitHub Release
|
60 |
+
if: env.tag_exists == 'false'
|
61 |
uses: softprops/action-gh-release@v1
|
62 |
with:
|
63 |
tag_name: "v${{ env.VERSION }}"
|