diff --git a/.github/files/gh-wp-svn-autopublish/files/wp-svn-autopublish.sh b/.github/files/gh-wp-svn-autopublish/files/wp-svn-autopublish.sh index 8064d3e26c6be..befbaa5a5c306 100755 --- a/.github/files/gh-wp-svn-autopublish/files/wp-svn-autopublish.sh +++ b/.github/files/gh-wp-svn-autopublish/files/wp-svn-autopublish.sh @@ -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. diff --git a/tools/deploy-to-svn.sh b/tools/deploy-to-svn.sh index 6e20d085fc8b0..26be309886c69 100755 --- a/tools/deploy-to-svn.sh +++ b/tools/deploy-to-svn.sh @@ -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}" @@ -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.