-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (83 loc) · 3.22 KB
/
Copy pathrelease.yml
File metadata and controls
97 lines (83 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release
on:
push:
branches:
- main
paths:
- 'lw-pixel.php'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Extract version from plugin file
id: get_version
run: |
VERSION=$(grep -m1 "Version:" lw-pixel.php | sed 's/.*Version:[[:space:]]*//' | tr -d '[:space:]')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
- name: Check if tag exists
id: check_tag
env:
VERSION: ${{ steps.get_version.outputs.version }}
run: |
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Tag v$VERSION already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Tag v$VERSION does not exist"
fi
- name: Setup PHP
if: steps.check_tag.outputs.exists == 'false'
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install production dependencies
if: steps.check_tag.outputs.exists == 'false'
run: composer install --no-dev --optimize-autoloader --no-interaction
- name: Create release ZIP
if: steps.check_tag.outputs.exists == 'false'
env:
VERSION: ${{ steps.get_version.outputs.version }}
run: |
mkdir -p dist/lw-pixel
rsync -av --exclude='.git' --exclude='.github' --exclude='dist' --exclude='builds' \
--exclude='composer.json' --exclude='composer.lock' --exclude='phpcs.xml.dist' \
--exclude='node_modules' --exclude='.gitignore' --exclude='.gitattributes' \
--exclude='tests' --exclude='docs' --exclude='.claude' --exclude='.superpowers' \
--exclude='phpstan.neon.dist' --exclude='phpstan-baseline.neon' \
--exclude='phpstan-bootstrap.php' --exclude='phpunit.xml.dist' --exclude='bin' \
--exclude='*.log' . dist/lw-pixel/
cd dist && zip -r "lw-pixel-${VERSION}.zip" lw-pixel/
- name: Create tag and release
if: steps.check_tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ steps.get_version.outputs.version }}
name: v${{ steps.get_version.outputs.version }}
body: |
## LW Pixel v${{ steps.get_version.outputs.version }}
### Installation
**Via Composer:**
```bash
composer require lwplugins/lw-pixel
```
**Manual Installation:**
1. Download `lw-pixel-${{ steps.get_version.outputs.version }}.zip`
2. Upload to `/wp-content/plugins/`
3. Activate in WordPress admin
### Changelog
See [readme.txt](https://github.com/lwplugins/lw-pixel/blob/main/readme.txt) for full changelog.
files: |
dist/lw-pixel-${{ steps.get_version.outputs.version }}.zip
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}