v3.9.0-beta-3 #70
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=$PLUGIN_SLUG.$VERSION.zip" >> $GITHUB_ENV | |
- name: Checkout Git repository | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.PAT }} | |
path: ${{ env.plugin_slug }} | |
submodules: true | |
- name: Check stable version in readme.txt | |
run: | | |
STABLE_TAG=$(grep -oP '(?<=Stable tag: ).*' ${{ env.plugin_slug }}/readme.txt | tr -d '[:space:]') | |
if [ "$STABLE_TAG" != "${{ env.version }}" ]; then | |
echo "Stable tag ($STABLE_TAG) does not match release version (${{ env.version }}). Halting execution." | |
exit 1 | |
fi | |
- 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 | |
# create zip file | |
zip -rq ${{ env.zip_file_name }} ${{ env.plugin_slug }} -x@.zipignore | |
- name: Add ZIP to release assets | |
uses: meeDamian/github-release@2.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: ${{ env.zip_file_name }} | |
gzip: false | |
allow_override: true |