99 tag :
1010 name : New tag
1111 runs-on : ubuntu-latest
12-
1312 steps :
1413 - uses : actions/checkout@v3
1514
1615 - name : Debug File List
1716 run : ls -R
1817
19- - name : Install SVN
18+ - name : Install SVN (Subversion)
2019 run : |
2120 sudo apt-get update
2221 sudo apt-get install subversion
2322
24- # -------------------------------------------
25- # KEEPING EXISTING README-FINDING LOGIC
26- # -------------------------------------------
2723 - name : Find Readme File
2824 id : find_readme
2925 run : |
26+ #readme_file=$(find . -type f -iname "readme.*" | head -n 1)
3027 readme_file=$(find . -maxdepth 1 -type f -iname "readme.txt" | head -n 1)
3128 if [ -n "$readme_file" ]; then
3229 echo "Readme file found: $readme_file"
@@ -36,36 +33,39 @@ jobs:
3633 exit 1
3734 fi
3835
39- # -------------------------------------------
40- # KEEPING EXISTING RELEASE NOTES LOGIC
41- # -------------------------------------------
4236 - name : Extract Release Notes
4337 id : release_notes
4438 run : |
4539 changelog_section_start="== Changelog =="
4640 current_tag="${{ github.ref_name }}"
4741 readme_file="${{ env.readme_file }}"
4842
43+ # Extract the version (strip 'refs/tags/' if it exists)
4944 version=${current_tag#refs/tags/}
5045
46+ # Read lines from the changelog section
5147 in_changelog=0
5248 release_notes=""
5349 capturing_version=0
54-
5550 while IFS= read -r line; do
51+ # Start capturing after finding the changelog section
5652 if [[ "$line" == "$changelog_section_start" ]]; then
5753 in_changelog=1
5854 continue
5955 fi
6056
57+ # Stop capturing if we encounter a new version or the end of the file
6158 if [[ $in_changelog -eq 1 && "$line" =~ ^= ]]; then
59+ # Check if this is the current version
6260 if [[ "$line" == "= $version =" ]]; then
6361 capturing_version=1
6462 elif [[ $capturing_version -eq 1 ]]; then
63+ # Stop if we see the next version
6564 break
6665 fi
6766 fi
6867
68+ # Capture lines only for the current version
6969 if [[ $capturing_version -eq 1 && -n "$line" ]]; then
7070 release_notes+="$line\n"
7171 fi
@@ -76,147 +76,34 @@ jobs:
7676 exit 1
7777 fi
7878
79+ # Debug: Print extracted release notes
80+ echo "Extracted release notes for version $version:"
81+ printf "%b" "$release_notes"
82+
83+ # Set output (fixed, now using Environment File)
7984 echo "notes<<EOF" >> $GITHUB_OUTPUT
8085 printf "%b\n" "$release_notes" >> $GITHUB_OUTPUT
8186 echo "EOF" >> $GITHUB_OUTPUT
8287
83- # -------------------------------------------
84- # CUSTOM SVN DEPLOY LOGIC
85- # -------------------------------------------
86- - name : Checkout WP.org SVN
87- run : |
88- svn co https://plugins.svn.wordpress.org/${{ github.event.repository.name }}/ svn-wp
89-
90- - name : Clean trunk
91- run : |
92- rm -rf svn-wp/trunk/*
93- mkdir -p svn-wp/trunk
94-
95- # -------------------------------------------
96- # Copy vendor WITHOUT autoload.php
97- # -------------------------------------------
98- - name : Copy vendor folder (excluding autoload.php)
88+ - name : Debug Release Notes
9989 run : |
100- if [ -d "vendor" ]; then
101- mkdir -p svn-wp/trunk/vendor
102- rsync -av \
103- --exclude='autoload.php' \
104- ./vendor/ svn-wp/trunk/vendor/
105- fi
106-
107- # -------------------------------------------
108- # Commit vendor folders one-by-one
109- # -------------------------------------------
110- - name : Commit vendor subfolders
111- run : |
112- if [ -d "svn-wp/trunk/vendor" ]; then
113- cd svn-wp/trunk/vendor
114-
115- for dir in */; do
116- echo "Processing vendor folder: $dir"
117-
118- cd "$dir"
119- svn add --force .
120- svn status
121-
122- svn commit -m "Add vendor folder: ${dir%/} for version ${{ github.ref_name }}" \
123- --username "${{ secrets.SVN_USERNAME }}" \
124- --password "${{ secrets.SVN_PASSWORD }}" \
125- || echo "Nothing to commit for $dir"
126-
127- cd ..
128- done
129- fi
90+ echo "Debugging Release Notes:"
91+ echo "${{ steps.release_notes.outputs.notes }}"
13092
131- # -------------------------------------------
132- # Copy remaining plugin files (excluding readme.txt + vendor)
133- # -------------------------------------------
134- - name : Copy remaining plugin files
135- run : |
136- rsync -av \
137- --exclude='vendor' \
138- --exclude='readme.txt' \
139- --exclude='svn-wp' \
140- ./ svn-wp/trunk/
141-
142- # -------------------------------------------
143- # Commit remaining plugin files
144- # -------------------------------------------
145- - name : Commit the rest of the plugin files
146- run : |
147- cd svn-wp
148- svn add --force trunk
149- svn status
150- svn commit -m "Add remaining plugin files for version ${{ github.ref_name }}" \
151- --username "${{ secrets.SVN_USERNAME }}" \
152- --password "${{ secrets.SVN_PASSWORD }}"
153-
154- # -------------------------------------------
155- # Create the tag from trunk
156- # -------------------------------------------
157- - name : Create new SVN tag
158- run : |
159- version="${GITHUB_REF##*/}"
160- cd svn-wp
161- svn cp trunk tags/$version
162- svn commit -m "Tag version $version" \
163- --username "${{ secrets.SVN_USERNAME }}" \
164- --password "${{ secrets.SVN_PASSWORD }}"
165-
166- # -------------------------------------------
167- # Add readme.txt AND vendor/autoload.php in trunk + tag
168- # -------------------------------------------
169- - name : Add final files readme and vendor/autoload.php
170- run : |
171- version="${GITHUB_REF##*/}"
172-
173- # add readme.txt to trunk
174- cp readme.txt svn-wp/trunk/readme.txt
175- svn -q add svn-wp/trunk/readme.txt || true
176-
177- # add readme.txt to tag
178- cp readme.txt svn-wp/tags/$version/readme.txt
179- svn -q add svn-wp/tags/$version/readme.txt || true
180-
181- # add autoload.php if exists
182- if [ -f "vendor/autoload.php" ]; then
183- cp vendor/autoload.php svn-wp/trunk/vendor/autoload.php
184- cp vendor/autoload.php svn-wp/tags/$version/vendor/autoload.php
185-
186- svn -q add svn-wp/trunk/vendor/autoload.php || true
187- svn -q add svn-wp/tags/$version/vendor/autoload.php || true
188- fi
189-
190- # -------------------------------------------
191- # Update stable tag in both readmes
192- # -------------------------------------------
193- - name : Update readme stable tag in trunk + tag
194- run : |
195- version="${GITHUB_REF##*/}"
196-
197- sed -i "s/^Stable tag:.*/Stable tag: $version/" svn-wp/trunk/readme.txt
198- sed -i "s/^Stable tag:.*/Stable tag: $version/" svn-wp/tags/$version/readme.txt
93+ - name : WordPress Plugin Deploy
94+ id : deploy
95+ uses : 10up/action-wordpress-plugin-deploy@stable
96+ with :
97+ generate-zip : true
19998
200- # -------------------------------------------
201- # Commit final updates (readme + autoload.php)
202- # -------------------------------------------
203- - name : Commit final readme + autoload.php
204- run : |
205- cd svn-wp
206- svn commit -m "Finalize stable tag and autoloader for version ${GITHUB_REF##*/}" \
207- --username "${{ secrets.SVN_USERNAME }}" \
208- --password "${{ secrets.SVN_PASSWORD }}"
209-
210- # -------------------------------------------
211- # CREATE GITHUB RELEASE (unchanged)
212- # -------------------------------------------
21399 - name : Create GitHub Release
214100 uses : softprops/action-gh-release@v2
215101 with :
216102 tag_name : ${{ github.ref_name }}
217103 body : ${{ steps.release_notes.outputs.notes }}
104+ files : ${{github.workspace}}/${{ github.event.repository.name }}.zip
218105
219106env :
220107 SVN_PASSWORD : ${{ secrets.SVN_PASSWORD }}
221108 SVN_USERNAME : ${{ secrets.SVN_USERNAME }}
222- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
109+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments