Repository navigation
126 lines (109 loc) · 3.7 KB
/
Copy pathrelease.yml
File metadata and controls
126 lines (109 loc) · 3.7 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Build the plugin ZIP and publish it on version tags.
name: Release
on:
push:
tags:
- '*.*.*'
- 'v*.*.*'
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Use Node.js 24
uses: actions/setup-node@v7
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Verify tag matches metadata versions
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME}"
version="${tag#v}"
if [ -z "$version" ]; then
echo "::error::Could not derive release version from tag '${tag}'."
exit 1
fi
echo "Release tag: ${tag}"
echo "Required version: ${version}"
php bin/check-metadata.php --version="${version}"
- name: Build package ZIP
run: npm run package
- name: Verify release ZIP
run: |
set -euo pipefail
zip_path="cloudflare-stream.zip"
if [ ! -f "$zip_path" ]; then
echo "::error file=$zip_path::Expected release ZIP was not created."
ls -la
exit 1
fi
echo "OK: $zip_path ($(wc -c < "$zip_path") bytes)"
mapfile -t entries < <(unzip -Z1 "$zip_path")
if [ "${#entries[@]}" -eq 0 ]; then
echo "::error::$zip_path is empty."
exit 1
fi
missing=0
required=(
"cloudflare-stream/cloudflare-stream.php"
"cloudflare-stream/readme.txt"
"cloudflare-stream/dist/blocks.build.js"
"cloudflare-stream/dist/blocks.css"
"cloudflare-stream/dist/style-blocks.css"
)
for path in "${required[@]}"; do
found=0
for entry in "${entries[@]}"; do
if [ "$entry" = "$path" ]; then
found=1
break
fi
done
if [ "$found" -ne 1 ]; then
echo "::error::$zip_path is missing required path: $path"
missing=1
else
echo "OK: $path"
fi
done
if [ "$missing" -ne 0 ]; then
echo "::error::Release ZIP failed structure checks."
printf '%s\n' "${entries[@]}" | head -n 80
exit 1
fi
- name: Generate release checksums
run: |
set -euo pipefail
zip_path="cloudflare-stream.zip"
sha256sum "$zip_path" > cloudflare-stream.zip.sha256
b2sum "$zip_path" > cloudflare-stream.zip.blake2
echo "SHA256:"
cat cloudflare-stream.zip.sha256
echo "BLAKE2b (b2sum):"
cat cloudflare-stream.zip.blake2
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
files: |
cloudflare-stream.zip
cloudflare-stream.zip.sha256
cloudflare-stream.zip.blake2
body: |
## New Installations
* Download the full plugin ZIP file from the [latest release of this plugin](https://github.com/B-Interactive/cloudflare-stream-wordpress/releases/latest)
* In the WordPress admin panel, go to Plugins > Add New > Upload Plugin and upload the ZIP file
## Updating
* If you're currently using plugin version 1.1.7 or newer, updating should hopefully now be supported within WordPress.
generate_release_notes: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}