Skip to content

Commit 548a96a

Browse files
committed
Changed code
1 parent 1292eb8 commit 548a96a

1 file changed

Lines changed: 22 additions & 23 deletions

File tree

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
name: Get Tag and Project Name
1+
name: Get Tag and Project Name on Release Publish
22

33
on:
4-
push:
5-
tags:
6-
- '*'
4+
release:
5+
types:
6+
- published # Triggered when a release is published
77

88
jobs:
99
get_tag:
1010
runs-on: ubuntu-latest
11+
1112
steps:
12-
- name: Extract Tag Name and Project Name
13+
- name: Check Release Tag and Extract Information
1314
id: extract_tag
1415
run: |
15-
# Check if the workflow was triggered by a tag push or manual dispatch
16-
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
17-
# Extract the tag name from the GITHUB_REF variable
18-
TAG_NAME="${GITHUB_REF##*/}"
19-
PROJECT_NAME="${TAG_NAME%-*}" # Assuming format is project-name-version, remove version to get the project name
20-
echo "Tag Name: $TAG_NAME"
21-
echo "Project Name: $PROJECT_NAME"
22-
else
23-
# If triggered manually, log a message
24-
echo "Manual trigger (no tag found)."
16+
# Get the tag associated with the release
17+
TAG_NAME="${GITHUB_REF##*/}"
18+
PROJECT_NAME="${TAG_NAME%-*}" # Remove version to get the project name
19+
20+
# Log the tag and project names
21+
echo "Release Tag: $TAG_NAME"
22+
echo "Project Name: $PROJECT_NAME"
23+
24+
# Skip if the tag starts with "ai-personas-"
25+
if [[ "$TAG_NAME" =~ ^ai-personas- ]]; then
26+
echo "Tag starts with ai-personas-, skipping further steps."
27+
exit 0 # Exit the job successfully but stop further steps
2528
fi
2629
27-
- name: Log Output
30+
- name: Log Project Information
2831
run: |
29-
echo "Workflow triggered."
30-
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
31-
echo "Tag: $TAG_NAME"
32-
echo "Project: $PROJECT_NAME"
33-
else
34-
echo "Manual trigger detected, no tag associated."
35-
fi
32+
echo "Workflow triggered by release publish."
33+
echo "Release Tag: $TAG_NAME"
34+
echo "Project Name: $PROJECT_NAME"

0 commit comments

Comments
 (0)