Skip to content

Commit f61285e

Browse files
Create is-vtag.yml
1 parent 7742e18 commit f61285e

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

.github/workflows/is-vtag.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Whether the tag is a semver tag
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
is_vtag:
7+
description: 'Whether the tag is a semver tag'
8+
value: ${{ jobs.filter-vtags.outputs.is_vtag }}
9+
10+
jobs:
11+
filter-vtags:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
is_vtag: ${{ steps.check-tag.outputs.is_vtag }}
15+
tag: ${{ steps.check-tag.outputs.tag }}
16+
steps:
17+
- name: Inputs
18+
run: |
19+
echo "GITHUB_REF_TYPE=${GITHUB_REF_TYPE}"
20+
echo "GITHUB_REF_NAME=${GITHUB_REF_NAME}"
21+
- name: Check tag pattern
22+
id: check-tag
23+
run: |
24+
if [[ "${GITHUB_REF_TYPE}" == "tag" && "${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
25+
echo "is_vtag=true" >> "$GITHUB_OUTPUT"
26+
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
27+
else
28+
echo "is_vtag=false" >> "$GITHUB_OUTPUT"
29+
fi
30+
- name: Outputs
31+
run: echo "Step output is_vtag = ${{ steps.check-tag.outputs.is_vtag }}" && echo "Step output tag = ${{ steps.check-tag.outputs.tag }}"

0 commit comments

Comments
 (0)