Repository navigation
91 lines (76 loc) · 2.55 KB
/
Copy pathrelease.yml
File metadata and controls
91 lines (76 loc) · 2.55 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
81
82
83
84
85
86
87
88
89
90
91
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
coverage: none
tools: composer
- uses: actions/setup-node@v7
with:
node-version: "22"
cache: npm
# The tag is the release. package.json, the plugin header, and the
# WordPress.org stable tag must all say the same version.
- name: Check the tag matches the version
run: |
tag="${GITHUB_REF_NAME#v}"
pkg="$(node -p "require('./package.json').version")"
header="$(awk '/^ \* Version:/ { print $3; exit }' pendulum-arc/pendulum-arc.php)"
stable="$(awk '/^Stable tag:/ { print $3; exit }' pendulum-arc/readme.txt)"
constant="$(sed -n "s/.*ARC_WORDPRESS_VERSION', '\\([^']*\\)'.*/\\1/p" pendulum-arc/pendulum-arc.php)"
fail=0
for name in pkg header stable constant; do
eval "value=\$$name"
if [ "$tag" != "$value" ]; then
echo "::error::$name is $value, tag is v$tag"
fail=1
fi
done
if [ "$fail" -ne 0 ]; then
exit 1
fi
echo "tag v$tag matches package.json, the plugin header, and Stable tag"
- name: PHP dependencies
run: composer install --no-interaction --prefer-dist
- name: PHP tests
run: composer test
- name: PHPCS
run: composer lint
- name: JavaScript dependencies
run: npm ci
- name: Lint JavaScript
run: npm run lint:js
- name: JavaScript tests
run: npm test
- name: Build
run: npm run build
- name: Pack the plugin
run: |
rm -f pendulum-arc.zip
zip -r pendulum-arc.zip pendulum-arc -x "*.DS_Store"
# Body comes from docs/releases/vX.Y.Z.md so every tag uses the same
# headed format. --generate-notes is not a fallback.
- name: Publish the GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
notes="docs/releases/${GITHUB_REF_NAME}.md"
if [ ! -f "$notes" ]; then
echo "::error::missing $notes - write it from docs/releasing.md"
exit 1
fi
gh release create "$GITHUB_REF_NAME" pendulum-arc.zip \
--title "$GITHUB_REF_NAME" \
--notes-file "$notes" \
--verify-tag