-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (130 loc) · 4.08 KB
/
wp-plugin-deploy.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
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
name: Deploy to WordPress.org
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+.[0-9]"
env:
plugin_name: vk-block-patterns
jobs:
php_unit:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.0', '8.1', '8.2']
wp-versions: ['6.7', '6.6', '6.5']
name: PHP Unit test ${{ matrix.php-versions }} / WP ${{ matrix.wp-versions }} Test
services:
mysql:
image: mysql:5.7
ports:
- 3306
env:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
steps:
- uses: actions/checkout@v3
# setup node based on the version from the .node-version file, fetched in the previous step
- name: Setup Node.js (.node-version)
uses: actions/setup-node@v3
with:
node-version: 20
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: install npm scripts
run: npm install
- name: install Composer Package
run: composer install
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
- name: Install several WordPress version by wp-env.override.json
run: WP_ENV_PHP_VERSION=${{ matrix.php-versions }} WP_ENV_CORE=WordPress/WordPress#${{ matrix.wp-versions }} npm run wp-env start --update
- name: Check WordPress Version
run: npm run wp-env run cli wp core version
# dist の中で build は実行している
- name: Build
run: npm run build
# PHPUnit
- name: PHP Unit Test
run: npm run phpunit
tag:
name: deploy to plugin directory
runs-on: ubuntu-latest
needs: [php_unit]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: install npm scripts
run: npm install
- name: install Composer Package
run: composer install --no-dev
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
- name: Build
run: npm run build
- name: deploy
run: bash bin/deploy.sh
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@master
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: vk-block-patterns
release:
name: release
runs-on: ubuntu-latest
needs: [php_unit]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: install npm scripts
run: npm install
- name: install Composer Package
run: composer install --no-dev
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
- name: Build
run: npm run build
- name: Make Distribution
run: bash bin/dist.sh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/${{ env.plugin_name }}.zip
asset_name: ${{ env.plugin_name }}.zip
asset_content_type: application/zip