Skip to content

Commit

Permalink
Added minor fixes for non wpe release. Added test script to output th…
Browse files Browse the repository at this point in the history
…ese changes to make sure they work.
  • Loading branch information
colinmurphy committed Feb 28, 2025
1 parent 2943748 commit ff3d554
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 1 deletion.
72 changes: 72 additions & 0 deletions .github/actions/debug/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: 'Test Plugin Deploy'
description: 'Upload zip file to releases tab'
branding:
icon: 'upload-cloud'
color: 'blue'

inputs:
github_token:
description: 'GitHub Token'
required: true

outputs:
zip-path:
description: 'Path to zip file'
value: ${{ steps.zip-main-release-for-github.outputs.zip-path }}
org-zip-path:
description: 'Path to .org zip file'
value: ${{ steps.zip-org-release-for-github.outputs.zip-path }}

runs:
using: 'composite'
steps:
- id: prepare
name: Prepare Environment
run: sudo apt-get update && sudo apt-get install zip rsync -y
shell: bash

- id: zip-main-release-for-github
name: Zip plugin for the main release
run: |
mkdir -p dist
rsync -av --exclude-from="${{ env.PLUGIN_DIR }}/.distignore" ${{ env.PLUGIN_DIR }}/ dist/${{ env.SLUG }}
zip_file="faustwp-${{ env.VERSION }}.zip"
zip -r "$zip_file" "dist/${{ env.SLUG }}"
echo "zip-path=$PWD/$zip_file" >> $GITHUB_ENV
shell: bash

- id: zip-org-release-for-github
name: Zip plugin for the non wpe-updater release
run: |
# Delete old directory
rm -rf dist
# Create dist folder and copy files while excluding .distignore items
mkdir -p dist
# Copy plugin files to dist folder and exclude external updater
rsync -av --exclude-from="${{ env.PLUGIN_DIR }}/.distignore" --exclude="includes/updates/check-for-updates.php" --exclude="includes/updates/class-plugin-updater.php" "${{ env.PLUGIN_DIR }}/" "dist/${{ env.SLUG }}"
# Updates for the CHANGELOG file
sed -i -e '/## 1.6.0/,+4d' "dist/${{ env.SLUG }}/CHANGELOG.md"
# Allow updates for .org
sed -i -e '/\* Update URI: false/d' "dist/${{ env.SLUG }}/faustwp.php"
# Create .org zip file
org_zip_file="faustwp-${{ env.VERSION }}.org.zip"
zip -r "$org_zip_file" "dist/${{ env.SLUG }}"
# Save zip path to output
echo "org-zip-path=$PWD/$org_zip_file" >> $GITHUB_ENV
shell: bash

- id: debug-org-changes
name: Debug Check .org Zip File
run: |
echo ".org zip file path: ${{ steps.zip-org.outputs.zip-path }}"
ls -lah ${{ steps.zip-org.outputs.zip-path }}
unzip -l ${{ steps.zip-org.outputs.zip-path }}
cat "dist/${{ env.SLUG }}/CHANGELOG.md"
cat "dist/${{ env.SLUG }}/faustwp.php"
shell: bash
5 changes: 4 additions & 1 deletion .github/actions/release-plugin/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ runs:
rsync -av --exclude-from="${{ env.PLUGIN_DIR }}/.distignore" --exclude="includes/updates/check-for-updates.php" --exclude="includes/updates/class-plugin-updater.php" "${{ env.PLUGIN_DIR }}/" "dist/${{ env.SLUG }}"
# Updates for the CHANGELOG file
sed -i -e 's/plugin updates from an external API endpoint./plugin updates from an external API endpoint when not installed from WordPress.org/' "dist/${{ env.SLUG }}/CHANGELOG.md"
sed -i -e '/## 1.6.0/,+4d' "dist/${{ env.SLUG }}/CHANGELOG.md"
# Allow updates for .org
sed -i -e '/\* Update URI: false/d' "dist/${{ env.SLUG }}/faustwp.php"
# Create .org zip file
org_zip_file="faustwp-${{ env.VERSION }}.org.zip"
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Debug GitHub Actions Environment

on:
push:
branches:
- chore-minor-fixes-for-faustwp-non-wpe-release

jobs:
release_packages:
name: Release Packages
runs-on: ubuntu-22.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full Git history

- name: Set Plugin Version (Fallback)
run: echo "PLUGIN_VERSION=1.0.0-test" >> $GITHUB_ENV

- name: Deploy WordPress Plugin
uses: ./.github/actions/debug
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
PLUGIN_DIR: plugins/faustwp
SLUG: faustwp
VERSION: ${{ env.PLUGIN_VERSION }}

0 comments on commit ff3d554

Please sign in to comment.