diff --git a/.github/actions/test-release/action.yml b/.github/actions/test-release/action.yml new file mode 100644 index 000000000..50f8c74ed --- /dev/null +++ b/.github/actions/test-release/action.yml @@ -0,0 +1,92 @@ +name: 'Test Plugin Deploy' +description: 'Upload zip file to releases tab' +branding: + icon: 'upload-cloud' + color: 'blue' + +outputs: + zip-path: + description: 'Path to zip file' + value: ${{ steps.zip.outputs.zip-path }} + org-zip-path: + description: 'Path to .org zip file' + value: ${{ steps.zip-org.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 + name: Zip Plugin (Main) + run: | + # Create dist folder and copy files while excluding .distignore items + 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 }}" + + # Save zip path to output + echo "::set-output name=zip-path::$PWD/$zip_file" + shell: bash + + - id: zip-org + name: Zip Plugin (.org version) + 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" "${{ 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" + + # 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 "::set-output name=zip-path::$PWD/$org_zip_file" + shell: bash + + - id: debug-main + name: Debug Check Main Zip File + run: | + echo "Main zip file path: ${{ steps.zip.outputs.zip-path }}" + ls -lah ${{ steps.zip.outputs.zip-path }} + unzip -l ${{ steps.zip.outputs.zip-path }} + shell: bash + + - id: debug-org + 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 }} + shell: bash + + # - id: upload-main + # name: Upload Main Zip File to Release + # uses: softprops/action-gh-release@v2 + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # files: ${{ steps.zip.outputs.zip-path }} + # asset_name: faustwp-${{ env.VERSION }}.zip + # overwrite: true + + # - id: upload-org + # name: Upload .org Zip File to Release + # uses: softprops/action-gh-release@v2 + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # files: ${{ steps.zip-org.outputs.zip-path }} + # asset_name: faustwp-${{ env.VERSION }}.org.zip + # overwrite: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..a7d959571 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: Test Release Packages + +on: + push: + branches: + - chore-update-faustwp-release-process + +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/test-release + env: + PLUGIN_DIR: plugins/faustwp + SLUG: faustwp + VERSION: ${{ env.PLUGIN_VERSION }} diff --git a/plugins/faustwp/faustwp.php b/plugins/faustwp/faustwp.php index adeec79c8..d23fae97a 100644 --- a/plugins/faustwp/faustwp.php +++ b/plugins/faustwp/faustwp.php @@ -61,8 +61,14 @@ function () { return; } -require FAUSTWP_DIR . '/includes/updates/class-plugin-updater.php'; -require FAUSTWP_DIR . '/includes/updates/check-for-updates.php'; +// Loads the updater service, if included in this build +if ( file_exists( FAUSTWP_DIR . '/includes/updates/class-plugin-updater.php' ) ) { + require FAUSTWP_DIR . '/includes/updates/class-plugin-updater.php'; +} + +if ( file_exists( FAUSTWP_DIR . '/includes/updates/check-for-updates.php' ) ) { + require FAUSTWP_DIR . '/includes/updates/check-for-updates.php'; +} require FAUSTWP_DIR . '/includes/auth/functions.php'; require FAUSTWP_DIR . '/includes/telemetry/functions.php'; require FAUSTWP_DIR . '/includes/replacement/functions.php';