Repository navigation
80 lines (75 loc) · 3.21 KB
/
Copy pathdeploy.yml
File metadata and controls
80 lines (75 loc) · 3.21 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
75
76
77
78
79
80
name: Deploy to WordPress.org
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
version:
description: 'Version to deploy (e.g. 1.9.0); on release events it is derived from the tag'
required: true
svn_cleanup:
description: 'Run the one-off SVN dev-file cleanup instead of deploying'
type: boolean
default: false
jobs:
tag:
name: New release
if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.svn_cleanup) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build assets
# The @gravitykit E2E packages live on the private npm.pkg.github.com
# registry, which this runner has no auth token for; they are
# test-only and not needed to build dist assets, so drop them before
# installing. package.json/package-lock.json are .distignore'd and
# never ship to wp.org.
run: |
npm pkg delete 'devDependencies.@gravitykit/e2e-bootstrap' 'devDependencies.@gravitykit/e2e-fixtures'
npm install --no-audit --no-fund
npm run build
- name: WordPress Plugin Deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: gravity-forms-zero-spam
ASSETS_DIR: .wordpress-org
# Empty on release events, so the action falls back to deriving
# the version from the tag ref. Manual runs have no tag ref and
# would otherwise try to create SVN tag "refs/heads/main".
VERSION: ${{ inputs.version }}
# One-off cleanup for the 1.9.0 deploy that shipped development files
# (tests/, scripts/, Gruntfile.js, translations.pot, .env.sample,
# .gktools.json) because .distignore was missing them. Lives here because
# GitHub would not register a standalone workflow file added after the
# fact; this job only runs when dispatched with svn_cleanup=true and can
# be removed once it has run.
svn_cleanup:
name: Remove dev files from wp.org SVN
if: ${{ github.event_name == 'workflow_dispatch' && inputs.svn_cleanup }}
runs-on: ubuntu-latest
steps:
- name: Remove dev files from trunk and tags/1.9.0
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq subversion
svn checkout --quiet --depth immediates https://plugins.svn.wordpress.org/gravity-forms-zero-spam svn-repo
cd svn-repo
svn update --quiet --set-depth infinity trunk tags/1.9.0
for dir in trunk tags/1.9.0; do
for path in .env.sample .gktools.json Gruntfile.js scripts tests translations.pot; do
if [ -e "$dir/$path" ]; then
svn rm "$dir/$path"
fi
done
done
echo "Pending changes:"
svn status
svn commit -m "Remove development files from trunk and 1.9.0 tag" \
--no-auth-cache --non-interactive \
--username "$SVN_USERNAME" --password "$SVN_PASSWORD"