-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (89 loc) · 2.5 KB
/
Copy pathbuild.yml
File metadata and controls
109 lines (89 loc) · 2.5 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
98
99
100
101
102
103
104
105
106
107
108
109
name: Build and Release
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Install dependencies
run: composer install
- name: Run PHPCS
run: vendor/bin/phpcs
eslint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
- name: Install dependencies
run: npm install
- name: Run ESLint
run: npm run eslint
build:
runs-on: ubuntu-latest
needs: [phpcs, eslint]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
- name: Install dependencies
run: npm install
- name: NPM Build
run: npm run build # Replace with your npm build script
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Composer Install
run: composer install --no-dev --no-suggest --optimize-autoloader --no-interaction
- name: Set Version in PHP File
run: |
sed -i "s/Version:.*$/Version: ${{ github.ref_name }}/" wordpress-settings.php
shell: bash
- name: zip
run: npm run plugin-zip
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: wordpress-settings.zip
release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Download build
uses: actions/download-artifact@v4
with:
name: build
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
mv wordpress-settings.zip "wordpress-settings-${{ github.ref_name }}.zip"
gh release create "${{ github.ref_name }}" \
--title "Release ${{ github.ref_name }}" \
--notes "Release ${{ github.ref_name }}" \
"wordpress-settings-${{ github.ref_name }}.zip"