Skip to content

Commit 98a7f32

Browse files
author
Natsuu
authored
ci: add is_prerelease argument to outputs in meta job (#22)
1 parent 08057b1 commit 98a7f32

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/install.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
fetch-depth: 0
2929
- id: set_tag
3030
run: |
31+
# 检查标签格式
3132
is_release=${{ startsWith(github.ref, 'refs/tags/v') }}
3233
tag=$(git describe --tags --match "v*" ${{ github.ref }} || true)
3334
if [[ $tag != v* ]]; then
@@ -37,17 +38,27 @@ jobs:
3738
fi
3839
tag=$(date "+$tag-%y%m%d-$(git rev-parse --short HEAD)")
3940
fi
41+
4042
if ! $($is_release) ; then
4143
prefix=${tag%-*-*}
4244
suffix=${tag#$prefix-}
4345
tag="$prefix-ci.$suffix"
4446
fi
4547
48+
# 检查是否为预发布版本
49+
is_prerelease=false
50+
if [[ $tag =~ .*alpha.* || $tag =~ .*beta.* || $tag =~ .*rc.* || $tag =~ .*dev.* || $tag =~ .*-ci.* ]]; then
51+
is_prerelease=true
52+
echo "This is a pre-release version"
53+
fi
54+
4655
echo tag=$tag | tee -a $GITHUB_OUTPUT
4756
echo is_release=$is_release | tee -a $GITHUB_OUTPUT
57+
echo is_prerelease=$is_prerelease | tee -a $GITHUB_OUTPUT
4858
outputs:
4959
tag: ${{ steps.set_tag.outputs.tag }}
5060
is_release: ${{ steps.set_tag.outputs.is_release }}
61+
is_prerelease: ${{ steps.set_tag.outputs.is_prerelease }}
5162

5263
install:
5364
needs: meta

0 commit comments

Comments
 (0)