forked from Billingegroup/release-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Check release tag and user privilege for release | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
tag-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Extract and validate tag for (pre)-release | ||
id: tag-check | ||
# Check if the tag matches the pattern, e.g. 3.1.32 or 0.1.3rc0 | ||
run: | | ||
TAG_NAME=${GITHUB_REF#refs/tags/} | ||
if [[ "$TAG_NAME" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || [[ "$TAG_NAME" =~ ^[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$ ]]; then | ||
echo "Valid tag: $TAG_NAME" | ||
else | ||
echo "Invalid tag: $TAG_NAME" | ||
exit 1 | ||
fi | ||
privilege-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check user role | ||
# FIXME: Replace sbillinge to bobleesj | ||
run: | | ||
if [ "${{ github.actor }}" != "bobleesj" ]; then | ||
echo "Error: Unauthorized user" | ||
exit 1 | ||
fi | ||
echo "User sbillinge is allowed to run this workflow." |