Skip to content

Generate Installable Plugin, and Upload as Release Asset #41

Generate Installable Plugin, and Upload as Release Asset

Generate Installable Plugin, and Upload as Release Asset #41

Workflow file for this run

# GitHub Action: whenever creating a new release of the source code,
# also create a release of the installable plugin.
# Steps to execute:
# - Checkout the source code
# - Run "composer install" to download all dependencies under vendor/
# - Create a .zip file, excluding:
# - All hidden files (.git, .gitignore, etc)
# - All development files, ending in .dist
# - All composer files <= after installing dependencies, no need for them anymore
# - Markdown files concerning development
# - Folder build/ <= created only to store the .zip file
# - Folder dev-helpers/ <= not needed for the plugin
# - Upload the .zip file as an artifact to the action (this step is possibly optional)
# - Upload the .zip file as a release, for download
name: Generate Installable Plugin, and Upload as Release Asset
on:
release:
types: [published]
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build project
run: |
mkdir build
- name: Create artifact
uses: montudor/action-zip@v1
with:
args: zip -X -r build/top-10.zip . -x *.git* node_modules/\* .* "*/\.*" CODE_OF_CONDUCT.md CONTRIBUTING.md ISSUE_TEMPLATE.md PULL_REQUEST_TEMPLATE.md *.dist *.neon *.yml composer.* dev-helpers** build** wporg-assets** phpunit** vendor** package.json
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: top-10
path: build/top-10.zip
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: build/top-10.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}