-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
113 lines (111 loc) · 5.49 KB
/
action.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
name: WordPress.org Text Replace
description: 'A helpful GitHub action that will handle replacing version numbers across plugin files.'
author: Scott Kingsley Clark <[email protected]>
branding:
icon: 'save'
color: green
inputs:
plugin_version:
description: 'Plugin version'
required: false
plugin_version_constant_name:
description: 'Plugin version constant name (if used)'
required: false
tested_wp_version:
description: 'Tested up to WP version'
required: false
tested_wp_version_constant_name:
description: 'Tested up to WP version constant name (if used)'
required: false
minimum_wp_version:
description: 'Minimum WP version'
required: false
minimum_wp_version_constant_name:
description: 'Minimum WP version constant name (if used)'
required: false
minimum_php_version:
description: 'Minimum PHP version'
required: false
minimum_php_version_constant_name:
description: 'Minimum PHP version constant name (if used)'
required: false
minimum_mysql_version:
description: 'Minimum MySQL version'
required: false
minimum_mysql_version_constant_name:
description: 'Minimum MySQL version constant name (if used)'
required: false
plugin_file:
description: 'Plugin file'
required: false
plugin_path:
description: 'Plugin path'
required: true
readme_md_file:
description: 'README.md file (if versioned)'
required: false
runs:
using: "composite"
steps:
- name: What are we doing?
run: |
echo plugin_version: ${{ inputs.plugin_version }}
echo plugin_version_constant_name: ${{ inputs.plugin_version_constant_name }}
echo tested_wp_version: ${{ inputs.tested_wp_version }}
echo tested_wp_version_constant_name: ${{ inputs.tested_wp_version_constant_name }}
echo minimum_wp_version: ${{ inputs.minimum_wp_version }}
echo minimum_wp_version_constant_name: ${{ inputs.minimum_wp_version_constant_name }}
echo minimum_php_version: ${{ inputs.minimum_php_version }}
echo minimum_php_version_constant_name: ${{ inputs.minimum_php_version_constant_name }}
echo minimum_mysql_version: ${{ inputs.minimum_mysql_version }}
echo minimum_mysql_version_constant_name: ${{ inputs.minimum_mysql_version_constant_name }}
echo plugin_file: ${{ inputs.plugin_file }}
echo plugin_path: ${{ inputs.plugin_path }}
echo readme_md_file: ${{ inputs.readme_md_file }}
shell: bash
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Get NPM cache directory to use
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
working-directory: ${{ github.action_path }}
shell: bash
- name: Setup NPM cache
uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install NPM dependencies
run: npm install
working-directory: ${{ github.action_path }}
shell: bash
- name: Update plugin version
if: "${{ inputs.plugin_version != '' }}"
run: npm run update-plugin-version --plugin_version="${{ inputs.plugin_version }}" --plugin_version_constant_name="${{ inputs.plugin_version_constant_name }}" --plugin_file="${{ inputs.plugin_file }}" --plugin_path="${{ inputs.plugin_path }}" --readme_md_file="${{ inputs.readme_md_file }}"
working-directory: ${{ github.action_path }}
shell: bash
- name: Update tested WP version
if: "${{ inputs.tested_wp_version != '' }}"
run: npm run update-tested-wp-version --tested_wp_version="${{ inputs.tested_wp_version }}" --tested_wp_version_constant_name="${{ inputs.tested_wp_version_constant_name }}" --plugin_file="${{ inputs.plugin_file }}" --plugin_path="${{ inputs.plugin_path }}" --readme_md_file="${{ inputs.readme_md_file }}"
working-directory: ${{ github.action_path }}
shell: bash
- name: Update minimum WP version
if: "${{ inputs.minimum_wp_version != '' }}"
run: npm run update-minimum-wp-version --minimum_wp_version="${{ inputs.minimum_wp_version }}" --minimum_wp_version_constant_name="${{ inputs.minimum_wp_version_constant_name }}" --plugin_file="${{ inputs.plugin_file }}" --plugin_path="${{ inputs.plugin_path }}" --readme_md_file="${{ inputs.readme_md_file }}"
working-directory: ${{ github.action_path }}
shell: bash
- name: Update minimum PHP version
if: "${{ inputs.minimum_php_version != '' }}"
run: npm run update-minimum-php-version --minimum_php_version="${{ inputs.minimum_php_version }}" --minimum_php_version_constant_name="${{ inputs.minimum_php_version_constant_name }}" --plugin_file="${{ inputs.plugin_file }}" --plugin_path="${{ inputs.plugin_path }}" --readme_md_file="${{ inputs.readme_md_file }}"
working-directory: ${{ github.action_path }}
shell: bash
- name: Update minimum MySQL version
if: "${{ inputs.minimum_mysql_version != '' }}"
run: npm run update-minimum-mysql-version --minimum_mysql_version="${{ inputs.minimum_mysql_version }}" --minimum_mysql_version_constant_name="${{ inputs.minimum_mysql_version_constant_name }}" --plugin_file="${{ inputs.plugin_file }}" --plugin_path="${{ inputs.plugin_path }}"
working-directory: ${{ github.action_path }}
shell: bash