@@ -3,13 +3,14 @@ name: Create Release
33on :
44 push :
55 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
910
1011jobs :
1112 create_release :
12- if : github.ref == 'refs/heads/master'
13+ # No need to check against branches, workflow only triggers on tags
1314 runs-on : ubuntu-latest
1415 steps :
1516 - uses : actions/checkout@v3
@@ -40,10 +41,15 @@ jobs:
4041 run : |
4142 changelog_section_start="== Changelog =="
4243 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
4753
4854 in_changelog=0
4955 found_version=0
@@ -105,8 +111,7 @@ jobs:
105111 # Write the release notes with actual line breaks
106112 echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
107113 echo -e "$release_notes" >> $GITHUB_ENV
108- echo "EOF" >> $GITHUB_ENV
109-
114+ echo "EOF" >> $GITHUB_ENV
110115
111116 - name : Create zip file
112117 run : |
0 commit comments