@@ -3,13 +3,14 @@ name: Create Release
3
3
on :
4
4
push :
5
5
tags :
6
- - ' *.*.*'
7
- branches :
8
- - master
6
+ - ' *.*.*' # Match semantic versioning tags
7
+ # Removed branches trigger to ensure it only runs on tags
8
+ # branches:
9
+ # - master
9
10
10
11
jobs :
11
12
create_release :
12
- if : github.ref == 'refs/heads/master'
13
+ # No need to check against branches, workflow only triggers on tags
13
14
runs-on : ubuntu-latest
14
15
steps :
15
16
- uses : actions/checkout@v3
@@ -40,10 +41,15 @@ jobs:
40
41
run : |
41
42
changelog_section_start="== Changelog =="
42
43
readme_file="$readme_file"
43
- #plugin_version="${{ github.ref_name }}" # Assuming the tag is the version
44
- plugin_version="${GITHUB_REF#refs/tags/}"
45
-
46
- echo "DEBUG: Plugin latest version found $plugin_version."
44
+
45
+ # Extract the tag name from GITHUB_REF (plugin_version)
46
+ if [[ "$GITHUB_REF" == refs/tags/* ]]; then
47
+ plugin_version="${GITHUB_REF#refs/tags/}"
48
+ echo "DEBUG: Plugin latest version found: $plugin_version."
49
+ else
50
+ echo "::error::This workflow must be triggered by a tag push."
51
+ exit 1
52
+ fi
47
53
48
54
in_changelog=0
49
55
found_version=0
@@ -105,8 +111,7 @@ jobs:
105
111
# Write the release notes with actual line breaks
106
112
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
107
113
echo -e "$release_notes" >> $GITHUB_ENV
108
- echo "EOF" >> $GITHUB_ENV
109
-
114
+ echo "EOF" >> $GITHUB_ENV
110
115
111
116
- name : Create zip file
112
117
run : |
@@ -137,4 +142,4 @@ jobs:
137
142
upload_url : ${{ steps.create_release.outputs.upload_url }}
138
143
asset_path : ./${{ env.repo_name }}.zip
139
144
asset_name : ${{ env.repo_name }}.zip
140
- asset_content_type : application/zip
145
+ asset_content_type : application/zip
0 commit comments