Ensure that a tag is in trunk before deploying to WP.org.#287
Ensure that a tag is in trunk before deploying to WP.org.#287peterwilsoncc wants to merge 1 commit into
Conversation
dkotter
left a comment
There was a problem hiding this comment.
Code changes look good to me and make sense.
As to this question:
I don't know how to test this, do you have any ideas?
Could potentially fork this repo and simulate a release on that fork, at least that's how we've tested similar things in the past. I'm not overly concerned though and can likely just :yolo: test this on the next release
I did this and it didn't quite work as I wanted. I could accidentally tag the release from develop as the tag exists in trunk once develop has been merged in to trunk. I'll do some more testing but I think what I want to do is check the tag points to the head of trunk: # Get the commit hash for the tag reference.
tag_commit=$(git log -n 1 --pretty=format:"%H" "${tag_ref}" 2>/dev/null)
# Get the commit hash for trunk.
trunk_commit=$(git log -n 1 --pretty=format:"%H" "origin/trunk" 2>/dev/null)
if [[ "${tag_commit}" != "${trunk_commit}" ]]; then
echo "Error: Tag ${tag_ref} does not point to the same commit as trunk." >&2
exit 1
fiHowever this would prevent us from releasing anything except the head of trunk so it might be overkill. |
Description of the Change
When tagging a release, ensure that the tag is on the branch
trunkbefore deploying to the WordPress.org plugin repo.The variables are sourced from the GitHub Actions Variable Reference.
Closes #285
How to test the Change
@jeffpaul or @dkotter I don't know how to test this, do you have any ideas?
Changelog Entry
Credits
Props @peterwilsoncc
Checklist: