Skip to content

Commit

Permalink
ci: upload plugin zip to releases workflow step (#1974)
Browse files Browse the repository at this point in the history
  • Loading branch information
theodesp authored Oct 30, 2024
1 parent 6dc0b21 commit de32574
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 144 deletions.
43 changes: 31 additions & 12 deletions .github/actions/release-plugin/action.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
name: 'WordPress Plugin Deploy'
description: 'Deploy to the WordPress Plugin Repository'
author: '10up'
name: 'Plugin Deploy'
description: 'Upload zip file to releases tab'
branding:
icon: 'upload-cloud'
color: 'blue'
inputs:
generate-zip:
description: 'Generate package zip file?'
default: false

outputs:
zip-path:
description: 'Path to zip file'
value: ${{ steps.deploy.outputs.zip-path }}
value: ${{ steps.zip.outputs.zip-path }}

runs:
using: 'composite'
steps:
- id: deploy
env:
INPUT_GENERATE_ZIP: ${{ inputs.generate-zip }}
run: ${{ github.action_path }}/deploy.sh
- id: prepare
name: Prepare Environment
run: |
sudo apt-get update && sudo apt-get install zip rsync -y
- id: zip
name: Zip Plugin (optional)
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 the plugin directory
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: upload
name: Upload Zip File to Release
uses: softprops/action-gh-release@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
files: ${{ steps.zip.outputs.zip-path }} # Updated to use zip-path output
asset_name: faustwp-${{ env.VERSION }}.zip # Set asset name to the correct versioned name
overwrite: true
108 changes: 0 additions & 108 deletions .github/actions/release-plugin/deploy.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,8 @@ jobs:
# Then deploy the WordPress plugin
# https://github.com/changesets/action#outputs
if: steps.changesets.outputs.published && contains(steps.changesets.outputs.publishedPackages, '"@faustwp/wordpress-plugin"')
# Use a variant of 10up/action-wordpress-plugin-deploy that allows us to specify a PLUGIN_DIR
# to support our monorepo structure.
uses: ./.github/actions/release-plugin
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
PLUGIN_DIR: plugins/faustwp
SLUG: faustwp
VERSION: ${{ env.PLUGIN_VERSION }}
20 changes: 0 additions & 20 deletions .github/workflows/release-plugin.yml

This file was deleted.

0 comments on commit de32574

Please sign in to comment.