v2.5.0 #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Add release ZIP | |
on: | |
release: | |
types: [published] | |
jobs: | |
create-zip: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set environment variables | |
env: | |
TAG_NAME: ${{ github.event.release.tag_name }} | |
run: | | |
# process existing variables | |
PLUGIN_SLUG="${PWD##*/}" | |
VERSION="${TAG_NAME#v}" | |
ZIP_FILE_NAME=$PLUGIN_SLUG.$VERSION.zip | |
# set environment variables | |
echo "plugin_slug=$PLUGIN_SLUG" >> $GITHUB_ENV | |
echo "version=$VERSION" >> $GITHUB_ENV | |
echo "zip_file_name_cjk=$PLUGIN_SLUG.$VERSION.CJK.zip" >> $GITHUB_ENV | |
echo "zip_file_name=$PLUGIN_SLUG.$VERSION.zip" >> $GITHUB_ENV | |
- name: Checkout Git repository | |
uses: actions/checkout@v2 | |
with: | |
path: ${{ env.plugin_slug }} | |
- name: Install composer dependencies | |
run: | | |
cd ${{ env.plugin_slug }} | |
composer install --no-dev | |
composer dump-autoload --optimize | |
- name: Create ZIP | |
run: | | |
# reformat .distignore: remove all empty lines, leading slashes and prefix with the folder | |
sed "/^[[:space:]]*$/d;s#^/##;s#^#${{ env.plugin_slug }}/#" ${{ env.plugin_slug }}/.distignore > .zipignore | |
sed "/^[[:space:]]*$/d;s#^/##;s#^#${{ env.plugin_slug }}/#" ${{ env.plugin_slug }}/.distignore-light > .zipignore-light | |
# create zip files | |
zip -rq ${{ env.zip_file_name }} ${{ env.plugin_slug }} [email protected] | |
zip -rq ${{ env.zip_file_name_cjk }} ${{ env.plugin_slug }} [email protected] | |
- name: Add ZIP to release asseets | |
uses: meeDamian/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: > | |
${{ env.zip_file_name }} | |
${{ env.zip_file_name_cjk }} | |
gzip: false | |
allow_override: true |