Skip to content

Commit ef10180

Browse files
Add build scripts and GitHub Actions release workflow
- bin/build.sh: local build — copies plugin files, patches version from git describe, creates dist/servmask-debug.zip - .github/actions/build: composite action for CI builds - .github/workflows/build-release.yml: builds and uploads ZIP on GitHub release (prereleased/released) - Use 'develop' as version placeholder in plugin header and constants - Add dist/ to .gitignore
1 parent b14e145 commit ef10180

7 files changed

Lines changed: 88 additions & 2 deletions

File tree

.github/actions/build/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Build
2+
3+
description: Build files for deployment
4+
5+
outputs:
6+
ASSET_PATH:
7+
description: Asset path to upload
8+
value: ${{ steps.build-sh.outputs.ASSET_PATH }}
9+
ASSET_NAME:
10+
description: Asset name to upload
11+
value: ${{ steps.build-sh.outputs.ASSET_NAME }}
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- id: build-sh
17+
run: ${{ github.action_path }}/build.sh
18+
shell: bash

.github/actions/build/build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
sudo apt-get install -y zip
4+
5+
rm -rf dist
6+
mkdir -p dist/$PLUGIN_NAME
7+
cp -R {lib,$PLUGIN_NAME.php,constants.php,loader.php,functions.php,uninstall.php,USER-GUIDE.md,DEBUG-GUIDE.md,README.md} dist/$PLUGIN_NAME
8+
9+
sed -i s/Version:\ develop/Version:\ $VERSION/ dist/$PLUGIN_NAME/$PLUGIN_NAME.php
10+
sed -i "s/define( 'AI1WM_DEBUG_VERSION', 'develop' )/define( 'AI1WM_DEBUG_VERSION', '$VERSION' )/" dist/$PLUGIN_NAME/constants.php
11+
12+
cd dist
13+
zip -vrm9 $PLUGIN_NAME-$VERSION.zip ./$PLUGIN_NAME
14+
15+
echo "ASSET_PATH=dist/$PLUGIN_NAME-$VERSION.zip" >> $GITHUB_OUTPUT
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Release
2+
3+
on:
4+
release:
5+
types:
6+
- prereleased
7+
- released
8+
9+
jobs:
10+
build-release:
11+
runs-on: ubuntu-latest
12+
name: Build Release
13+
env:
14+
PLUGIN_NAME: 'servmask-debug'
15+
VERSION: ${{ github.ref_name }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Install PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: '7.4'
26+
27+
- name: Build
28+
id: build
29+
uses: ./.github/actions/build
30+
31+
- name: Upload release asset
32+
uses: softprops/action-gh-release@v2
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
files: ${{ steps.build.outputs.ASSET_PATH }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
storage/
2+
dist/

bin/build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -e
3+
4+
rm -rf dist; mkdir -p dist/servmask-debug
5+
cp -R {lib,servmask-debug.php,constants.php,loader.php,functions.php,uninstall.php,USER-GUIDE.md,DEBUG-GUIDE.md,README.md} dist/servmask-debug
6+
version=`git describe`
7+
8+
if [ "$(uname)" == "Darwin" ]; then
9+
sed -i '' s/Version:\ develop/Version:\ $version/ dist/servmask-debug/servmask-debug.php
10+
sed -i '' "s/define( 'AI1WM_DEBUG_VERSION', 'develop' )/define( 'AI1WM_DEBUG_VERSION', '$version' )/" dist/servmask-debug/constants.php
11+
else
12+
sed -i s/Version:\ develop/Version:\ $version/ dist/servmask-debug/servmask-debug.php
13+
sed -i "s/define( 'AI1WM_DEBUG_VERSION', 'develop' )/define( 'AI1WM_DEBUG_VERSION', '$version' )/" dist/servmask-debug/constants.php
14+
fi
15+
16+
cd dist; zip -vrm9 servmask-debug.zip ./servmask-debug

constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
// Version
27-
define( 'AI1WM_DEBUG_VERSION', '1.0.0' );
27+
define( 'AI1WM_DEBUG_VERSION', 'develop' );
2828

2929
// Plugin name
3030
define( 'AI1WM_DEBUG_PLUGIN_NAME', 'servmask-debug' );

servmask-debug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Universal debug and support tool for the ServMask plugin ecosystem
66
* Author: ServMask
77
* Author URI: https://servmask.com/
8-
* Version: 1.0.0
8+
* Version: develop
99
* Network: True
1010
*
1111
* Copyright (C) 2014-2026 ServMask Inc.

0 commit comments

Comments
 (0)