Skip to content

Commit 25341a8

Browse files
committed
Optimize GitHub Actions workflows
1 parent 8688bff commit 25341a8

2 files changed

Lines changed: 70 additions & 23 deletions

File tree

.github/workflows/codingstandard.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,55 @@ on:
44
push:
55
branches:
66
- master
7-
paths-ignore:
8-
- '**.md'
7+
paths:
8+
- '.github/workflows/codingstandard.yml'
9+
- 'build/**'
10+
- 'package.json'
11+
- 'package-lock.json'
12+
- 'src/**'
913

1014
pull_request:
1115
branches:
1216
- master
17+
paths:
18+
- '.github/workflows/codingstandard.yml'
19+
- 'build/**'
20+
- 'package.json'
21+
- 'package-lock.json'
22+
- 'src/**'
1323

1424
workflow_dispatch:
1525

26+
concurrency:
27+
group: coding-standards-${{ github.event.pull_request.number || github.ref }}
28+
cancel-in-progress: true
29+
1630
jobs:
1731
lint:
1832
name: Lint and build
1933
runs-on: ubuntu-latest
2034

2135
steps:
2236
- name: Checkout
23-
uses: actions/checkout@v4
37+
uses: actions/checkout@v5
2438

2539
- name: Setup Node
26-
uses: actions/setup-node@v4
40+
uses: actions/setup-node@v5
2741
with:
2842
node-version: 20
2943
cache: 'npm'
44+
cache-dependency-path: package-lock.json
45+
46+
- name: Restore node_modules
47+
id: node-modules-cache
48+
uses: actions/cache@v4
49+
with:
50+
path: node_modules
51+
key: ${{ runner.os }}-node-20-modules-${{ hashFiles('package-lock.json') }}
3052

3153
- name: Install dependencies
32-
run: npm ci
54+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
55+
run: npm ci --prefer-offline --no-audit --no-fund
3356

3457
- name: Lint JS
3558
run: npx wp-scripts lint-js
@@ -38,4 +61,4 @@ jobs:
3861
run: npx wp-scripts lint-style
3962

4063
- name: Build
41-
run: npx wp-scripts build
64+
run: npx wp-scripts build

.github/workflows/deploy.yml

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,44 @@
11
name: Deploy to WordPress.org
2+
23
on:
3-
push:
4-
tags:
5-
- '*'
4+
push:
5+
tags:
6+
- '*'
7+
8+
concurrency:
9+
group: deploy-${{ github.ref }}
10+
cancel-in-progress: true
11+
612
jobs:
7-
tag:
8-
name: New tag
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v4
12-
- name: Build
13-
run: |
14-
npm install @wordpress/scripts --save-dev --save-exact @wordpress/scripts
15-
npm run build
16-
- name: WordPress Plugin Deploy
17-
uses: 10up/action-wordpress-plugin-deploy@stable
18-
env:
19-
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
20-
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
13+
tag:
14+
name: New tag
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v5
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v5
21+
with:
22+
node-version: 20
23+
cache: 'npm'
24+
cache-dependency-path: package-lock.json
25+
26+
- name: Restore node_modules
27+
id: node-modules-cache
28+
uses: actions/cache@v4
29+
with:
30+
path: node_modules
31+
key: ${{ runner.os }}-node-20-modules-${{ hashFiles('package-lock.json') }}
32+
33+
- name: Install dependencies
34+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
35+
run: npm ci --prefer-offline --no-audit --no-fund
36+
37+
- name: Build
38+
run: npm run build
39+
40+
- name: WordPress Plugin Deploy
41+
uses: 10up/action-wordpress-plugin-deploy@stable
42+
env:
43+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
44+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}

0 commit comments

Comments
 (0)