-
-
Notifications
You must be signed in to change notification settings - Fork 4
35 lines (33 loc) · 1.21 KB
/
version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Detect version
on:
workflow_call:
outputs:
version:
description: Version (in SemVer format)
value: ${{ jobs.detect.outputs.version }}
release-type:
description: Release type (alpha, beta or release)
value: ${{ jobs.detect.outputs.release-type }}
pre-release:
description: Whether is this version a pre-release (boolean)
value: ${{ jobs.detect.outputs.pre-release }}
jobs:
detect:
name: Detect version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
release-type: ${{ steps.version.outputs.release-type }}
pre-release: ${{ steps.version.outputs.pre-release }}
steps:
- id: version
run: |
TAG=${{ github.ref }}
VERSION=${TAG#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
IS_PRE_RELEASE="false"
RELEASE_TYPE="release"
[[ $VERSION =~ .+(beta|pre|rc).* ]] && RELEASE_TYPE="beta" && IS_PRE_RELEASE="true"
[[ $VERSION =~ .+(alpha).* ]] && RELEASE_TYPE="alpha" && IS_PRE_RELEASE="true"
echo "release-type=$RELEASE_TYPE" >> $GITHUB_OUTPUT
echo "pre-release=$IS_PRE_RELEASE" >> $GITHUB_OUTPUT