forked from GatherPress/gatherpress
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.38 KB
/
wordpress-org-plugin-guidelines.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
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
name: 'WordPress.org plugin directory guidelines'
on: # rebuild any PRs and main branch changes
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/wordpress-org-plugin-guidelines.yml'
- 'includes/**'
- 'src/**'
- 'package.*'
- '*.js'
- '*.php'
push:
branches:
- main
jobs:
wp-org-plugin-guidelines:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: latest
coverage: none
tools: wp-cli
- name: Install latest version of dist-archive-command
run: wp package install wp-cli/dist-archive-command:dev-main
- name: Setup Node
uses: actions/setup-node@v4
with:
# Make sure to use the same version like WordPress/gutenberg.
node-version-file: '.nvmrc'
# Enable built-in functionality for caching and restoring dependencies, which is disabled by default.
# The actions/setup-node uses actions/cache under the hood.
# https://github.com/actions/setup-node#caching-global-packages-data
cache: 'npm'
# Restoring the short lived node_modules cache
# to be used across all workflows running on the last commit.
# https://github.com/actions/cache/blob/main/caching-strategies.md#creating-a-short-lived-cache
- uses: actions/cache/restore@v4
id: node_modules-cache
with:
path: |
./node_modules
key: ${{ runner.os }}-node_modules-${{ github.sha }}-${{ hashFiles('package-lock.json') }}
- name: NPM install
if: steps.node_modules-cache.outputs.cache-hit != 'true'
run: npm ci --legacy-peer-deps
# Creating a short lived node_modules cache
- uses: actions/cache/save@v4
if: steps.node_modules-cache.outputs.cache-hit != 'true'
with:
path: |
./node_modules
key: ${{ steps.node_modules-cache.outputs.cache-primary-key }}
- name: Build plugin
run: |
npm run build
wp dist-archive . ./gatherpress.zip
mkdir tmp-build
unzip gatherpress.zip -d tmp-build
- name: Run plugin check
uses: wordpress/plugin-check-action@v1
with:
build-dir: './tmp-build/gatherpress'
wp-version: 'trunk'