1+ name : Publish Plugin to Github Releases
2+ on :
3+ push :
4+ tags :
5+ - ' *'
6+
7+ jobs :
8+ release :
9+ runs-on : self-hosted
10+ container :
11+ image : ubuntu:latest
12+ steps :
13+ - uses : actions/checkout@v4
14+
15+ - name : Install system dependencies
16+ shell : bash
17+ run : |
18+ apt-get update
19+ apt-get install -y zip unzip composer
20+
21+ - name : Set up Node
22+ uses : actions/setup-node@v4
23+ with :
24+ node-version-file : ' .nvmrc'
25+
26+ - name : Install dependencies
27+ shell : bash
28+ run : |
29+ composer install --no-dev
30+ npm i
31+
32+ - name : Build Library
33+ shell : bash
34+ run : npm run build:prod
35+
36+ - name : Create WordPress Plugin Zip
37+ id : create-zip
38+ shell : bash
39+ run : |
40+ # Create a temporary directory for the plugin
41+ mkdir -p /tmp/onedesign/assets/build
42+
43+ # Copy necessary files to the plugin directory
44+ cp -r assets/build /tmp/onedesign/assets/
45+ cp composer.json /tmp/onedesign/
46+ cp -r inc/ /tmp/onedesign/
47+ cp onedesign.php /tmp/onedesign/
48+ cp README.md /tmp/onedesign/
49+ cp -r vendor/ /tmp/onedesign/
50+
51+ # Create the zip file
52+ cd /tmp
53+ zip -r onedesign.zip onedesign/ -x "*.git*" "*.DS_Store*" "*node_modules*" "*tests*" "*test*"
54+
55+ # Move zip to workspace
56+ mv onedesign.zip $GITHUB_WORKSPACE/
57+
58+ # Set output for the zip path
59+ echo "zip-path=$GITHUB_WORKSPACE/onedesign.zip" >> $GITHUB_OUTPUT
60+
61+ # Display zip contents for verification
62+ echo "=== Plugin zip contents ==="
63+ unzip -l $GITHUB_WORKSPACE/onedesign.zip
64+
65+ - name : Upload Release Artifact
66+ if : startsWith(github.ref, 'refs/tags/dry') == false && github.ref != 'refs/heads/develop'
67+ 68+ with :
69+ files : |
70+ ${{ steps.create-zip.outputs.zip-path }}
71+ token : ' ${{ github.token }}'
72+ tag_name : ${{ github.ref_name }}
73+ draft : true
74+ generate_release_notes : true
75+ name : OneDesign ${{ github.ref_name }}
0 commit comments