Skip to content

Commit

Permalink
Action for release ZIP
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmigf committed Dec 16, 2024
1 parent 23fd8ed commit 024f489
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/.wordpress-org/*
/.git/*
/.github/*
/node_modules/*
/*/.git
/*/.github

.distignore
.gitignore
.gitattributes
.gitmodules
composer.json
composer.lock
46 changes: 46 additions & 0 deletions .github/workflows/release-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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@v3
with:
token: ${{ secrets.PAT }}
path: ${{ env.plugin_slug }}
submodules: true

- 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 }} [email protected]
- name: Add ZIP to release asseets
uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: ${{ env.zip_file_name }}
gzip: false
allow_override: true

0 comments on commit 024f489

Please sign in to comment.