Skip to content

Commit c0845f7

Browse files
authored
Merge pull request #867 from Automattic/security/harden-github-workflows
2 parents 6c72487 + a0d23d0 commit c0845f7

20 files changed

+105
-201
lines changed

.distignore

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,47 @@
11
# Directories
22
/.git/
33
/.github/
4+
/.claude/
5+
/.phpunit.cache/
6+
/artifacts/
47
/bin/
8+
/dist/
9+
/documentation/
510
/node_modules/
611
/tests/
712
/vendor/
813

9-
# Files
14+
# Development configuration
1015
.distignore
1116
.editorconfig
1217
.gitattributes
1318
.gitignore
19+
.nvmrc
1420
.phpcs.xml.dist
21+
.prettierignore
22+
.prettierrc
23+
.svnignore
1524
.wp-env.json
1625
.wp-env.override.json
17-
CHANGELOG.md
26+
27+
# Build tooling
28+
babel.config.js
29+
eslint.config.js
30+
jest.config.js
31+
playwright.config.js
32+
webpack.config.js
33+
34+
# Package management
1835
composer.json
1936
composer.lock
2037
package.json
2138
package-lock.json
39+
40+
# Documentation (not needed in plugin distribution)
41+
CHANGELOG.md
42+
CONTRIBUTING.md
43+
PUBLISHING.md
44+
SECURITY.md
45+
46+
# Test configuration
2247
phpunit.xml.dist

.github/workflows/deploy.yml

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+
release:
5+
types: [released]
6+
workflow_dispatch:
7+
8+
# Workflow-level permissions set to none; jobs declare their own minimal permissions
9+
permissions: {}
10+
11+
jobs:
12+
release:
13+
name: Deploy to WordPress.org
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write # Required to upload release assets to the GitHub release
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22+
with:
23+
persist-credentials: false
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
27+
with:
28+
node-version: '20'
29+
# Disabled to prevent cache poisoning in release workflows
30+
package-manager-cache: false
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Build assets
36+
run: npm run build
37+
38+
- name: Install SVN
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install -y subversion
42+
43+
- name: Deploy to WordPress.org
44+
uses: 10up/action-wordpress-plugin-deploy@54bd289b8525fd23a5c365ec369185f2966529c2 # v2.3.0
45+
with:
46+
generate-zip: true
47+
env:
48+
SLUG: edit-flow
49+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
50+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
51+
52+
- name: Upload release asset
53+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
54+
with:
55+
files: ${{ github.workspace }}/${{ github.event.repository.name }}.zip
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/php-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323

2424
steps:
2525
- name: Checkout code
26-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2727
with:
2828
persist-credentials: false
2929

3030
- name: Setup PHP
31-
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # 2.32.0
31+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
3232
with:
3333
php-version: '8.2'
3434
tools: composer, cs2pr

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ wordpress
44
vendor
55
composer.lock
66
build/
7+
dist/
8+
**/lib/dist/
79

810
# Test files
911
.phpunit.cache/

.svnignore

Lines changed: 0 additions & 15 deletions
This file was deleted.

.wordpress-org/icon-256x256.png

2.13 KB
Loading

0 commit comments

Comments
 (0)