Skip to content

Commit 0c8d400

Browse files
author
WordPress.org
committed
Add assets from wordpress.org and repo framework
1 parent 2cfc5e2 commit 0c8d400

20 files changed

+29109
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy to WordPress.org
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- trunk
8+
9+
jobs:
10+
deploy-to-wordpress:
11+
if: >
12+
github.event_name == 'pull_request' &&
13+
github.event.pull_request.merged == true &&
14+
startsWith(github.event.pull_request.head.ref, 'release/') &&
15+
( contains(github.event.pull_request.head.ref, '/major') || contains(github.event.pull_request.head.ref, '/minor') || contains(github.event.pull_request.head.ref, '/patch') ) &&
16+
( github.event.pull_request.user.login == 'github-actions[bot]' )
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 20
25+
- name: Install node dependencies
26+
run: npm install
27+
28+
- name: Compile JavaScript App
29+
run: npm run build
30+
31+
- name: Get New Version
32+
id: get-version
33+
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
34+
35+
- name: Create Tag and Release on GitHub
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
run: |
39+
VERSION=v${{ steps.get-version.outputs.VERSION }}
40+
git tag $VERSION
41+
git push origin $VERSION
42+
gh release create $VERSION --generate-notes
43+
44+
- name: Deploy Plugin to WordPress Plugin Directory
45+
uses: 10up/action-wordpress-plugin-deploy@stable
46+
env:
47+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
48+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
49+
VERSION: ${{ steps.get-version.outputs.VERSION }}
50+
SLUG: advanced-custom-fields
51+
52+
- name: WordPress.org plugin asset/readme update
53+
uses: 10up/action-wordpress-plugin-asset-update@stable
54+
env:
55+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
56+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
57+
SLUG: advanced-custom-fields

.github/workflows/pr-checks.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Run checks
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- trunk
7+
jobs:
8+
lint:
9+
name: Lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Setup Node
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version-file: '.nvmrc'
19+
cache: npm
20+
21+
- name: Install dependencies
22+
uses: php-actions/composer@v6
23+
with:
24+
args: --ignore-platform-reqs
25+
26+
- name: Install Dependencies
27+
run: npm i
28+
29+
- name: Run PHP Lint
30+
run: npm run lint:php
31+
32+
- name: Run JS Lint
33+
if: success() || failure()
34+
run: npm run lint:js
35+
36+
- name: Run CSS Lint
37+
if: success() || failure()
38+
run: npm run lint:css
39+
40+
- name: Run Markdown Lint
41+
if: success() || failure()
42+
run: npm run lint:md-docs
43+
44+
- name: Run package.json Lint
45+
if: success() || failure()
46+
run: npm run lint:pkg-json
47+
48+
tests:
49+
name: Test Suite
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v3
54+
55+
- name: Setup Node
56+
uses: actions/setup-node@v3
57+
with:
58+
node-version-file: '.nvmrc'
59+
cache: npm
60+
61+
- name: Install Composer
62+
uses: php-actions/composer@v6
63+
with:
64+
args: --ignore-platform-reqs
65+
66+
- name: Install Node Dependencies
67+
run: npm i
68+
69+
- name: Compile JavaScript App
70+
run: npm run build
71+
72+
- name: Setup MySQL
73+
if: success() || failure()
74+
uses: shogo82148/actions-setup-mysql@v1
75+
with:
76+
mysql-version: '8.0'
77+
78+
- name: Run JavaScript unit tests
79+
run: npm run test:unit
80+
81+
- name: Run PHP tests
82+
run: |
83+
mysql -uroot -h127.0.0.1 -e 'SELECT version()' \
84+
&& ./bin/install-wp-tests.sh --wp-version=trunk --recreate-db wordpress_test root '' > /dev/null \
85+
&& composer run-script test
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Create new release PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: 'Release type'
8+
required: true
9+
type: choice
10+
options:
11+
- major
12+
- minor
13+
- patch
14+
15+
jobs:
16+
prepare-release:
17+
if: github.event_name == 'workflow_dispatch'
18+
name: Prepare Release PR
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: 20
28+
29+
- name: Install node dependencies
30+
run: npm install
31+
32+
- name: Compile Javascript App
33+
run: npm run build
34+
35+
- name: Create version update branch
36+
id: create-branch
37+
run: |
38+
BRANCH_NAME="release/$(date +%Y-%m-%d)/${{ github.event.inputs.release_type }}-release"
39+
git checkout -b $BRANCH_NAME
40+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
41+
42+
- name: Update version and changelog
43+
id: update-version
44+
run: |
45+
npm run update-version
46+
echo "NEW_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
47+
env:
48+
RELEASE_TYPE: ${{ github.event.inputs.release_type }}
49+
50+
- name: Commit changes
51+
run: |
52+
git config user.name 'github-actions[bot]'
53+
git config user.email 'github-actions[bot]@users.noreply.github.com'
54+
git add .
55+
git commit -m "Version bump & changelog update" --no-verify
56+
git push --set-upstream origin ${{ steps.create-branch.outputs.BRANCH_NAME }}
57+
58+
- name: Create Pull Request
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
run: |
62+
gh pr create \
63+
--title "[Automation] New ${{ github.event.inputs.release_type }} Release: ${{ steps.update-version.outputs.NEW_VERSION }}" \
64+
--base trunk \
65+
--head ${{ steps.create-branch.outputs.BRANCH_NAME }} \
66+
--label "Release: ${{ github.event.inputs.release_type }}" \
67+
--body "
68+
### Release PR 🤖
69+
This is a release PR for version **${{ steps.update-version.outputs.NEW_VERSION }}**, run by **@${{ github.actor }}**.
70+
It updates the version of the Plugin and adds changes since the last tag to the Changelog file.
71+
Merging this PR will trigger a new release and update the Plugin in the WordPress Plugin Directory."

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ignore dependency directories
2+
node_modules/
3+
vendor/
4+
5+
# ignore log files and databases
6+
*.log
7+
*.sql
8+
*.sqlite
9+
10+
# ignore system files
11+
.DS_Store
12+
.vscode
13+
14+
# plugin build folder
15+
# /assets/build/
16+
# To be uncommented once build system is up.
17+
18+
# Ignore local override files
19+
.wp-env.override.json
20+
21+
# phpunit
22+
*.result.*

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.10

.wordpress-org/banner-1544x500.jpg

52.8 KB
Loading

.wordpress-org/banner-772x250.jpg

25 KB
Loading

.wordpress-org/icon-128x128.png

1.4 KB
Loading

.wordpress-org/icon-256x256.png

2.95 KB
Loading

.wordpress-org/icon.svg

Lines changed: 6 additions & 0 deletions
Loading

.wordpress-org/screenshot-1.jpg

726 KB
Loading

.wordpress-org/screenshot-2.jpg

344 KB
Loading

.wordpress-org/screenshot-3.jpg

323 KB
Loading

.wordpress-org/screenshot-4.jpg

212 KB
Loading

.wordpress-org/screenshot-5.jpg

658 KB
Loading

composer.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "wordpress/secure-custom-fields",
3+
"type": "package",
4+
"description": "Secure Custom Fields",
5+
"homepage": "https://github.com/WordPress/secure-custom-fields",
6+
"license": "GPL-2.0-or-later",
7+
"authors": [
8+
{
9+
"name": "Contributors",
10+
"homepage": "https://github.com/WordPress/secure-custom-fields/contributors.md"
11+
}
12+
],
13+
"config": {
14+
"process-timeout": 0,
15+
"platform": {
16+
"php": "7.4"
17+
},
18+
"allow-plugins": {
19+
"dealerdirect/phpcodesniffer-composer-installer": true,
20+
"composer/installers": true
21+
}
22+
},
23+
"require-dev": {
24+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
25+
"squizlabs/php_codesniffer": "^3.5",
26+
"phpcompatibility/phpcompatibility-wp": "^2.1.3",
27+
"wp-coding-standards/wpcs": "^2.2",
28+
"sirbrillig/phpcs-variable-analysis": "^2.8",
29+
"spatie/phpunit-watcher": "^1.23",
30+
"yoast/phpunit-polyfills": "^1.1",
31+
"sempro/phpunit-pretty-print": "^1.4"
32+
},
33+
"require": {
34+
"composer/installers": "~1.0"
35+
},
36+
"scripts": {
37+
"format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source",
38+
"lint": "phpcs --standard=phpcs.xml.dist",
39+
"test": "phpunit",
40+
"test:watch": "phpunit-watcher watch < /dev/tty"
41+
}
42+
}

0 commit comments

Comments
 (0)