-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (66 loc) · 2.34 KB
/
generate-zip.yml
File metadata and controls
74 lines (66 loc) · 2.34 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
name: Generate Plugin Zip
on:
workflow_call:
inputs:
ref:
description: 'Git Commit Reference (branch, tag, or hash - optional)'
required: false
type: string
default: ${{ github.ref }}
plugin_slug:
description: 'Plugin Slug'
required: true
type: string
install_composer_packages:
description: 'Whether composer needs to be run as part of the build'
type: boolean
required: false
default: true
install_npm_packages:
description: 'Whether NPM needs to be run as part of the build'
type: boolean
required: false
default: true
jobs:
generate-zip:
runs-on: ubuntu-latest
steps:
# Check out the repository
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
token: ${{ secrets.MACHINE_USER_PAT }}
submodules: "recursive"
# Install composer dependencies
- name: Install composer dependencies
uses: php-actions/composer@v6
if: ${{ inputs.install_composer_packages }}
with:
php_version: 7.4
dev: no
# Set up Node.js
- uses: actions/setup-node@v3
with:
node-version: '12'
# Install npm dependencies and build for translation
- name: Install npm dependencies & build for translation
if: ${{ inputs.install_npm_packages }}
run: |
npm install -g npm@7
npm ci
npm run build
# Replace text strings for internationalization
- uses: ithemes/github-actions/.github/actions/lion-i18n@master
with:
textdomain: ${{ inputs.plugin_slug }}
# Generate POT file for translations
- name: Generate pot file
run: |
curl -O https://github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
php -d xdebug.mode=off "$(which wp)" i18n make-pot ${{github.workspace}} ${{github.workspace}}/lang/${{ inputs.plugin_slug }}.pot --exclude="$(cat .distignore | tr "\n" "," | sed 's/,$/ /' | tr " " "\n"),src/*.js,src/**/*.js,blocks/**/*.js"
# Generate plugin zip file
- uses: ithemes/github-actions/.github/actions/generate-plugin-zip@master
with:
plugin_slug: ${{ inputs.plugin_slug }}