Skip to content

Commit 018fcc1

Browse files
Pass version explicitly to the release GH action
1 parent 48286c1 commit 018fcc1

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/deploy-to-wp-org.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,21 @@ jobs:
7878
- name: Prepare build directory
7979
run: npx grunt prepare
8080

81+
# Read once so both the tag check and the deploy step use the exact same value, rather
82+
# than letting the deploy action derive its own version from GITHUB_REF - that only works
83+
# when triggered from a tag push, and yields a bogus value like "refs/heads/master" (which
84+
# SVN then can't use as a tag path) on a workflow_dispatch run against a branch.
85+
- name: Read plugin version
86+
run: echo "PLUGIN_VERSION=$(cat .version | tr -d '[:space:]')" >> "$GITHUB_ENV"
87+
8188
# Ensure the version in the .version file matches the tag of the release.
8289
# Skipped for manual runs, which may not be run against a release tag.
8390
- name: Verify version matches tag
8491
if: github.event_name == 'release'
8592
run: |
8693
TAG="${GITHUB_REF_NAME#v}"
87-
FILE_VERSION=$(cat .version | tr -d '[:space:]')
88-
if [ "$TAG" != "$FILE_VERSION" ]; then
89-
echo "::error::Tag $TAG does not match .version $FILE_VERSION"
94+
if [ "$TAG" != "$PLUGIN_VERSION" ]; then
95+
echo "::error::Tag $TAG does not match .version $PLUGIN_VERSION"
9096
exit 1
9197
fi
9298
@@ -102,6 +108,7 @@ jobs:
102108
env:
103109
BUILD_DIR: 'build'
104110
SLUG: 'cloudinary-image-management-and-manipulation-in-the-cloud-cdn'
111+
VERSION: ${{ env.PLUGIN_VERSION }}
105112
# Use secrets to authenticate with WP.org.
106113
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
107114
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}

0 commit comments

Comments
 (0)