-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (68 loc) · 2.85 KB
/
Copy pathassets.yml
File metadata and controls
74 lines (68 loc) · 2.85 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: Update WordPress.org assets
# Syncs the plugin directory assets (icon, banner, screenshots) from
# .wordpress-org/ to the WordPress.org SVN /assets folder. These live only in
# SVN, never in the shipped plugin zip.
#
# Runs when .wordpress-org/ changes on main, after a deploy has published a
# release, or manually. The deploy trigger is there for a release that lands
# later than the assets it belongs with; on the common path, where one commit
# carries both, the push run does the work and the deploy run finds nothing
# left to change.
on:
push:
branches: [main]
paths:
- ".wordpress-org/**"
workflow_run:
workflows: ["Deploy to WordPress.org"]
types: [completed]
workflow_dispatch:
# A release commit can trigger this workflow twice, from the push and from the
# deploy. One at a time, and never cancelled - a half-finished SVN commit is
# worse than a slow one. The deploy deliberately does not share this group: it
# would then queue behind a run that is waiting for it.
concurrency:
group: wordpress-org-svn
cancel-in-progress: false
permissions:
contents: read
actions: read
jobs:
assets:
name: Sync plugin directory assets
# A deploy that failed leaves trunk in a state nothing should be synced
# against, and its own failure is the thing worth looking at.
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
# The concurrency group above only serialises runs that have already
# started. A release commit fires this workflow from the push and the
# deploy from the release seconds apart, in either order, so whichever
# gets there first has to stand aside for the deploy.
- name: Wait for an in-flight deploy
if: github.event_name != 'workflow_run'
env:
GH_TOKEN: ${{ github.token }}
run: |
# The release is published moments after the push that triggered this
# run, so a first look can be too early to see the deploy at all.
sleep 30
for _ in $(seq 1 60); do
running=$(gh run list --repo "$GITHUB_REPOSITORY" --workflow deploy.yml \
--json status --jq '[.[] | select(.status != "completed")] | length')
if [ "$running" = "0" ]; then
exit 0
fi
echo "A deploy is running; waiting for it to finish before touching SVN."
sleep 20
done
echo "::error::A deploy has been running for 20 minutes. Not syncing assets on top of it."
exit 1
- name: Checkout
uses: actions/checkout@v6
- name: Update assets on WordPress.org
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: captchaapi