|
1 | | -name: Get Tag and Project Name |
| 1 | +name: Get Tag and Project Name on Release Publish |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - tags: |
6 | | - - '*' |
| 4 | + release: |
| 5 | + types: |
| 6 | + - published # Triggered when a release is published |
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 | get_tag: |
10 | 10 | runs-on: ubuntu-latest |
| 11 | + |
11 | 12 | steps: |
12 | | - - name: Extract Tag Name and Project Name |
| 13 | + - name: Check Release Tag and Extract Information |
13 | 14 | id: extract_tag |
14 | 15 | 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 |
25 | 28 | fi |
26 | 29 |
|
27 | | - - name: Log Output |
| 30 | + - name: Log Project Information |
28 | 31 | 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