-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (65 loc) · 2.49 KB
/
release.yml
File metadata and controls
81 lines (65 loc) · 2.49 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
name: Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
permissions:
contents: write
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build plugin
run: npm run build
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create plugin zip
run: |
# Create a clean directory for the release
# Folder name must match the installed plugin folder
mkdir -p release/integration-features
# Copy only the files needed for production
cp -r build release/integration-features/
cp integration-features.php release/integration-features/
cp readme.txt release/integration-features/ 2>/dev/null || true
cp CHANGELOG.md release/integration-features/ 2>/dev/null || true
cp LICENSE release/integration-features/ 2>/dev/null || true
# Create the zip file
# Asset name must be $repo-*.zip for Git Updater (repo slug: integration-features)
cd release
zip -r ../integration-features-${{ steps.get_version.outputs.VERSION }}.zip integration-features
cd ..
- name: Extract changelog for this version
id: changelog
run: |
# Extract changelog section for this version
VERSION="${{ steps.get_version.outputs.VERSION }}"
CHANGELOG=$(awk "/^## \[?${VERSION}\]?/,/^## \[?[0-9]/" CHANGELOG.md | sed '$d' | tail -n +2)
# If no changelog found, use a default message
if [ -z "$CHANGELOG" ]; then
CHANGELOG="Release version ${VERSION}"
fi
# Write to file for multi-line support
echo "$CHANGELOG" > changelog_extract.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: integration-features-${{ steps.get_version.outputs.VERSION }}.zip
body_path: changelog_extract.txt
draft: false
prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') || contains(github.ref, '-rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}