Skip to content

plugin check fixed

plugin check fixed #23

Workflow file for this run

name: Deploy to WordPress.org
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
deploy:
name: Deploy WordPress Plugin
runs-on: ubuntu-latest
steps:
- name: Checkout Git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install SVN
run: sudo apt-get update && sudo apt-get install -y subversion
# 🔍 Find Readme File (from your original workflow)
- 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
source $GITHUB_ENV
if [ -z "$readme_file" ]; then
echo "::error::Readme file not found."
exit 1
fi
# 🧾 Extract Release Notes (from your original workflow)
- name: Extract Release Notes
id: release_notes
run: |
changelog_section_start="== Changelog =="
readme_file="$readme_file"
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
plugin_version="${GITHUB_REF#refs/tags/}"
echo "Plugin version: $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=""
while IFS= read -r line; do
if [[ "$line" == "$changelog_section_start" ]]; then
in_changelog=1
continue
fi
if [[ $in_changelog -eq 0 ]]; then
continue
fi
if [[ "$line" == "= ${plugin_version} =" ]]; then
found_version=1
continue
fi
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^= [0-9]+\.[0-9]+\.[0-9]+ =$'; then
break
fi
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^\*'; then
release_notes+="${line}\n"
fi
done < "$readme_file"
if [[ -z "$release_notes" ]]; then
echo "::error::Failed to extract release notes for version ${plugin_version}."
exit 1
fi
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo -e "$release_notes" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Prepare environment variables
id: vars
run: |
VERSION="${GITHUB_REF#refs/tags/}"
SLUG=$(basename "${GITHUB_REPOSITORY}")
echo "version=${VERSION}" >> $GITHUB_ENV
echo "slug=${SLUG}" >> $GITHUB_ENV
echo "🔧 Detected plugin slug: ${SLUG}"
- name: Checkout WordPress.org SVN
run: |
SVN_URL="https://plugins.svn.wordpress.org/${slug}"
SVN_DIR="$HOME/svn-wordpress"
echo "📦 Checking out SVN repo..."
svn co "$SVN_URL" "$SVN_DIR" --depth immediates
svn update "$SVN_DIR/trunk" --set-depth infinity
svn update "$SVN_DIR/tags" --set-depth immediates
- name: Sync files to trunk
run: |
SVN_DIR="$HOME/svn-wordpress"
echo "🚀 Syncing files to trunk..."
rsync -rc --exclude-from=.distignore ./ "$SVN_DIR/trunk/" --delete
cp readme.txt "$SVN_DIR/readme.txt" || true
- name: Commit trunk changes to SVN
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
run: |
SVN_DIR="$HOME/svn-wordpress"
cd "$SVN_DIR/trunk"
echo "🧩 Committing trunk updates..."
svn add --force . --auto-props --parents --depth infinity -q
svn ci -m "Update trunk for version ${version}" \
--username "$SVN_USERNAME" \
--password "$SVN_PASSWORD" \
--non-interactive
- name: Tag the new version in SVN
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
run: |
SVN_DIR="$HOME/svn-wordpress"
cd "$SVN_DIR"
echo "🏷️ Creating tag ${version}..."
svn copy trunk "tags/${version}" \
-m "Tagging version ${version}" \
--username "$SVN_USERNAME" \
--password "$SVN_PASSWORD" \
--non-interactive
# 🎉 Create GitHub Release (from your original workflow)
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
body: ${{ env.RELEASE_NOTES }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}