-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (118 loc) · 4 KB
/
Copy pathtest-and-deploy.yml
File metadata and controls
143 lines (118 loc) · 4 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Test and Deploy
on:
pull_request:
paths-ignore:
- '**.md'
push:
branches: [main]
tags: ['*']
paths-ignore:
- '**.md'
jobs:
lint-js:
name: Lint JS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Install Node dependencies
run: npm ci
- name: Run JS lint
run: npm run lint-js
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Install Node dependencies
run: npm ci
- name: Run type check
run: npm run lint:type
lint-php:
name: Lint PHP
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install Composer dependencies
run: composer install --no-progress --no-interaction
- name: Run PHP lint
run: composer lint
phpunit:
name: PHPUnit (PHP ${{ matrix.php }} / WP ${{ matrix.wp }})
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.2', '8.4']
wp: ['6.7', '7.0']
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install Node dependencies
run: npm ci
- name: Install Composer dependencies
run: composer install --no-progress --no-interaction
- name: Run PHPUnit
run: npm run test:php
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wp == 'latest' && '' || format('WordPress/WordPress#{0}', matrix.wp) }}
release:
name: Upload Release Asset
needs: [lint-js, typecheck, lint-php, phpunit]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
attestations: write
id-token: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install Node dependencies and build
run: npm ci && npm run build
- name: Install Composer production dependencies
run: composer install --no-dev --no-progress --no-interaction --optimize-autoloader
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
generate-zip: true
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: schedule-terms
- name: Upload release asset
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ github.workspace }}/${{ github.event.repository.name }}.zip