-
Notifications
You must be signed in to change notification settings - Fork 5
43 lines (38 loc) · 1.3 KB
/
release.yml
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
name: Release
on:
push:
branches:
- trunk
jobs:
check_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for version change
id: version_check
run: |
OLD_VERSION=$(git show HEAD^:remote-data-blocks.php | sed -n 's/.*Version: *//p' | tr -d '[:space:]')
NEW_VERSION=$(git show HEAD:remote-data-blocks.php | sed -n 's/.*Version: *//p' | tr -d '[:space:]')
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "Version changed from $OLD_VERSION to $NEW_VERSION"
else
echo "No version change detected"
fi
- name: Setup PHP
if: steps.version_check.outputs.new_version
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- name: Build plugin zip
if: steps.version_check.outputs.new_version
run: npm ci && npm run plugin-zip
- name: Create Release
if: steps.version_check.outputs.new_version
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version_check.outputs.new_version }}
files: remote-data-blocks.zip
generate_release_notes: true