Skip to content

Commit 55cf65a

Browse files
Add version verification
1 parent 2bf9662 commit 55cf65a

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
uses: actions/checkout@v4
1818
with:
1919
fetch-depth: 0
20+
- name: Verify version matches release tag
21+
run: bin/check-version
2022
- name: WordPress Plugin Deploy
2123
id: deploy
2224
uses: tinify/action-wordpress-plugin-deploy@stable

bin/check-version

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Script assumes release tags are formatted as MAJOR.MINOR.PATCH
5+
6+
# https://docs.github.com/en/actions/reference/workflows-and-actions/variables
7+
# For workflows triggered by release, this is the release tag created.
8+
TAG_VERSION="${1:-${GITHUB_REF#refs/tags/}}"
9+
10+
# Stable tag from readme.txt
11+
README_VERSION=$(grep -m 1 "^Stable tag:" readme.txt | awk '{print $3}')
12+
13+
if [ "$TAG_VERSION" != "$README_VERSION" ]; then
14+
echo "Error: Tag: $TAG_VERSION, readme.txt: $README_VERSION"
15+
exit 1
16+
fi
17+
18+
echo "Version matches git release"

0 commit comments

Comments
 (0)