Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: Avoid double-tagging in wporg SVN #28437

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ svn up trunk
echo '::endgroup::'

echo "::group::Checking out SVN tags (shallowly)"
svn up tags --depth=empty
svn up tags --depth=immediates
echo '::endgroup::'

if [[ -e "tags/$TAG" ]]; then
echo "::error::Tag $TAG already exists in SVN. Aborting."
exit 1
fi

echo "::group::Deleting everything in trunk except for .svn directories"
find trunk ! \( -path '*/.svn/*' -o -path "*/.svn" \) \( ! -type d -o -empty \) -delete
[[ -e trunk ]] || mkdir -p trunk # If there were no .svn directories, trunk itself might have been removed.
Expand Down
12 changes: 11 additions & 1 deletion tools/deploy-to-svn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ if [[ -z "$WPSLUG" ]]; then
fi
$FAIL && exit 1

if jq -e '.extra["wp-svn-autopublish"] // false' "$PLUGIN_DIR/composer.json" &>/dev/null; then
yellow "$PLUGIN_NAME is set up to automatically publish to WordPress.org via GitHub Actions."
yellow $'\e[1mIf you run this script in addition to the auto-publish, you\'ll likely wind up with a broken tag (see https://github.com/Automattic/jetpack/issues/28400).'
proceed_p '' 'Really publish to SVN manually?'
fi

# Check build dir.
if [[ -z "$BUILD_DIR" ]]; then
TMPDIR="${TMPDIR:-/tmp}"
Expand Down Expand Up @@ -124,9 +130,13 @@ printf "\r\e[K"
success "Done!"

info "Checking out SVN tags shallowly to $DIR/tags"
svn -q up tags --depth=empty
svn -q up tags --depth=immediates
success "Done!"

if [[ -e "tags/$SVNTAG" ]]; then
die "Tag $SVNTAG already exists in SVN. Aborting."
fi

info "Deleting everything in trunk except for .svn directories"
find trunk ! \( -path '*/.svn/*' -o -path "*/.svn" \) \( ! -type d -o -empty \) -delete
[[ -e trunk ]] || mkdir -p trunk # If there were no .svn directories, trunk itself might have been removed.
Expand Down