Skip to content

Build a zip archive of your WordPress plugin & theme using GitHub Actions

License

Notifications You must be signed in to change notification settings

webshr/action-wp-build-archive

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordPress Build Archive GitHub Action

A GitHub Action to generate a zip archive of a WordPress project using WP-CLI.

Usage Example

Place the following in /.github/workflows/main.yml

on: push
name: 🚀 Build WordPress Plugin on Push
jobs:
  build-deploy:
    name: 🎉 Build archive
    runs-on: ubuntu-latest
    steps:
      - name: 🚚 Checkout latest code
        uses: actions/checkout@v4

      - name: 📦 Build Plugin
        uses: webshr/deploy-wp-update-server@latest
        with:
          install-composer: true # optional; defaults to no-dev
          composer-no-dev: true # optional; defaults to false
          npm-run-build: true # optional; defaults to false
          node-version: 20 # optional; defaults to '20.x'
          retention-days: 5 # optional; defaults to 30
          archive-name: my-plugin # optional; defaults to repository-name
          upload-artifact: false # optional; defaults to true

Excluding files from the archive

You can specify files or directories to be excluded from an archive using a .distignore or a .gitattributes file. It's recommended to use a .distignore file, especially for built files in .gitignore. The .gitattributes file is useful for projects that don't run a build step and ensures consistency with files committed to WordPress.org.

.gitignore example:

/.wordpress-org
/.git
/node_modules

.distignore
.gitignore

.gitattributes example:

# Directories
/.github export-ignore

# Files
/.gitattributes export-ignore
/.gitignore export-ignore

Configuration

Add your keys directly to your .yml configuration file or referenced from the Secrets project store.

It is strongly recommended to save sensive credentials as secrets.

Key Name Required Example Default Description
install-composer no true false Install composer packages before generating archive
npm-run-build no true false Run npm run build before generating archive
node-version no 20 18 Node version
retention-days no 3 30 Number of days to retain the arhive
archive-name no my-plugin repository-name Name of the zip archive
upload-artifact no true false Opt-out for artifact upload

Credits

This action is inspired by and builds upon the work done in the Generate WordPress Archive and WordPress Plugin Build Zip Actions.

Further Reading

License

This action is licensed under the MIT License.

About

Build a zip archive of your WordPress plugin & theme using GitHub Actions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages