version 2.7.5 released #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to WordPress.org | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
tag: | |
name: New tag | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Debug File List | |
run: ls -R | |
- name: Install SVN (Subversion) | |
run: | | |
sudo apt-get update | |
sudo apt-get install subversion | |
- name: Find Readme File | |
id: find_readme | |
run: | | |
for file in readme.txt Readme.txt README.txt README.md Readme.md readme.md; do | |
if [ -f "$file" ]; then | |
echo "Readme file found: $file" | |
echo "readme_file=$file" >> $GITHUB_ENV | |
break | |
fi | |
done | |
# Ensure the variable is available within the current step | |
source $GITHUB_ENV | |
if [ -z "$readme_file" ]; then | |
echo "::error::Readme file not found." | |
exit 1 | |
fi | |
- name: Extract Release Notes | |
id: release_notes | |
run: | | |
changelog_section_start="== Changelog ==" | |
readme_file="$readme_file" | |
# Extract the tag name from GITHUB_REF (plugin_version) | |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
plugin_version="${GITHUB_REF#refs/tags/}" | |
echo "DEBUG: Plugin latest version found: $plugin_version." | |
else | |
echo "::error::This workflow must be triggered by a tag push." | |
exit 1 | |
fi | |
in_changelog=0 | |
found_version=0 | |
release_notes="" | |
echo "DEBUG: Starting to extract release notes from $readme_file for version $plugin_version." | |
while IFS= read -r line; do | |
echo "DEBUG: Processing line: $line" | |
# Start processing after the changelog header | |
if [[ "$line" == "$changelog_section_start" ]]; then | |
in_changelog=1 | |
echo "DEBUG: Found changelog section header." | |
continue | |
fi | |
# Skip if not in changelog section | |
if [[ $in_changelog -eq 0 ]]; then | |
echo "DEBUG: Skipping line (not in changelog section)." | |
continue | |
fi | |
# Check for the current version header | |
if [[ "$line" == "= ${plugin_version} =" ]]; then | |
found_version=1 | |
echo "DEBUG: Found version header for $plugin_version." | |
continue | |
fi | |
# Break if a new version header is found after the current version | |
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^= [0-9]+\.[0-9]+\.[0-9]+ =$'; then | |
echo "DEBUG: Found a new version header. Stopping collection." | |
break | |
fi | |
# Collect lines starting with '*' if we are in the current version section | |
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^\*'; then | |
echo "DEBUG: Found changelog entry: $line" | |
release_notes+="${line}\n" | |
continue | |
fi | |
# Log skipped lines in the current version section | |
if [[ $found_version -eq 1 ]]; then | |
echo "DEBUG: Skipping line (not a changelog entry): $line" | |
fi | |
done < "$readme_file" | |
if [[ -z "$release_notes" ]]; then | |
echo "::error::Failed to extract release notes for version ${plugin_version}." | |
exit 1 | |
fi | |
echo "DEBUG: Successfully extracted release notes." | |
echo "DEBUG: Release notes content:" | |
echo -e "$release_notes" | |
# Write the release notes with actual line breaks | |
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | |
echo -e "$release_notes" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
#- name: Deploy WordPress.org Assets | |
# uses: 10up/action-wordpress-plugin-asset-update@stable | |
# env: | |
# SVN_USERNAME: ${{ secrets.SVN_USERNAME }} | |
# SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} | |
- name: WordPress Plugin Deploy | |
id: deploy | |
uses: 10up/action-wordpress-plugin-deploy@stable | |
with: | |
generate-zip: true | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ github.ref_name }} | |
body: ${{ env.RELEASE_NOTES }} | |
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip | |
env: | |
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} | |
SVN_USERNAME: ${{ secrets.SVN_USERNAME }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |