Skip to content

Commit

Permalink
Update release-wp-plugins-and-theme.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebBarnes committed Jan 4, 2024
1 parent 491c8a9 commit 3a7648f
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions .github/workflows/release-wp-plugins-and-theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,24 @@ jobs:

- name: Zip all plugins and themes
run: |
main_dir=$(pwd)
for dir in wordpress/plugins/* wordpress/theme/*; do
if [ -d "$dir" ]; then
item_name=$(basename "$dir")
# For plugins, look for a PHP file with the same name as the directory
if [[ "$dir" == wordpress/plugins/* ]]; then
version=$(grep -Po '(?<=Version: )(\d+\.\d+\.?\d*)' "$dir/$item_name.php")
version=$(grep -Po '(?<=Version: )(\d+\.\d+\.?\d*)' "$dir/$item_name.php" || echo "")
fi
# For themes, look for the version in style.css
if [[ "$dir" == wordpress/theme/* ]]; then
version=$(grep -Po '(?<=Version: )(\d+\.\d+\.?\d*)' "$dir/style.css")
version=$(grep -Po '(?<=Version: )(\d+\.\d+\.?\d*)' "$dir/style.css" || echo "")
fi
# If version is found, append it to the zip filename
if [ ! -z "$version" ]; then
zip -r "${item_name}-v${version}.zip" "$dir"
else
zip -r "${item_name}.zip" "$dir"
fi
# Change to the directory and zip the contents, then move back
(cd "$dir" && zip -r "${main_dir}/${item_name}${version:+-v$version}.zip" .)
fi
done
Expand All @@ -51,16 +49,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

# - name: Remove "latest" tag from previous release (if it exists)
# run: |
# latest_release_tag="latest"
# previous_release_id=$(gh release list --limit 2 | awk 'NR==2 {print $1}')
# if [ -n "$previous_release_id" ]; then
# gh release edit $previous_release_id --tag "$latest_release_tag-remove"
# fi
# env:
# GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Upload all zipped items to Release
run: |
for zip_file in *.zip; do
Expand All @@ -70,11 +58,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

# - name: Add "latest" tag to release
# run: gh release edit ${{ github.ref_name }} --title "Release ${{ github.ref_name }}" --notes "Release notes" --tag latest
# env:
# GITHUB_TOKEN: ${{ secrets.PAT }}

# Trigger the update-docs-latest-release-links.yml workflow here
- name: Trigger update-docs workflow
run: gh workflow run update-docs-latest-release-links.yml
Expand Down

0 comments on commit 3a7648f

Please sign in to comment.