Created
September 4, 2023 20:05
-
-
Save Daniel217D/2f694d37e02334ae11e598a68c5225fb to your computer and use it in GitHub Desktop.
Script for updating plugin at wordpress.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Exit if any command fails. | |
set -e | |
# Define variables | |
PLUGIN_SLUG="test-plugin" # Replace with your plugin's slug | |
SVN_REPO="https://plugins.svn.wordpress.org/$PLUGIN_SLUG" | |
NEW_TAG="$1" # The new tag version (passed as a command-line argument) | |
# ENV Переменные | |
svn_username="$SVN_USERNAME" | |
svn_password="$SVN_PASSWORD" | |
# Check if the NEW_TAG variable is empty | |
if [ -z "$NEW_TAG" ] | |
then | |
echo "\$NEW_TAG is empty" | |
exit 1 | |
fi | |
# Create a ZIP archive of the plugin | |
bash ./bin/zip.sh | |
# Remove the local 'svn' directory if it exists | |
rm -rf svn | |
# Check out the WordPress SVN repository for the plugin into the 'svn' directory | |
svn co "$SVN_REPO" svn | |
# Remove the 'trunk' directory from the checked-out repository | |
rm -rf svn/trunk | |
# Copy the contents of the plugin from the 'build' directory to 'svn/trunk' | |
cp -r build/wc-tinkoff-secure-deal-payment-gateway svn/trunk | |
# Change the working directory to the 'svn' directory | |
cd svn | |
# Create a new tag in the SVN repository by copying the contents of 'trunk' to 'tags/$NEW_TAG' | |
svn cp trunk "tags/$NEW_TAG" | |
# Commit the new tag to the SVN repository with a commit message | |
svn ci -m "Publish $NEW_TAG github release" --username *** --password *** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment