Skip to content

Releasing a new version on wordpress.org

Konrad Karpieszuk edited this page Sep 3, 2024 · 10 revisions

Prerequisites

You have those scripts in your .bashrc

function wc_price_update_svn_trunk() {
    cd ~/tmp
    rm -rfv wc-price-history
    git clone [email protected]:kkarpieszuk/wc-price-history.git
    cd wc-price-history
    prepare_wc_price_history_for_release
    rm -rfv ../wc-price-history-svn/wc-price-history/trunk/*
    cp --recursive -v . ../wc-price-history-svn/wc-price-history/trunk/
    cd ../wc-price-history-svn/wc-price-history/
    svn status
    echo "nie zapomnij recznie dodac nowych plikow do sledzonych!"
}

function prepare_wc_price_history_for_release() {
    wp i18n make-pot . languages/wc-price-history.pot
    rm -rf vendor/
    rm -rf node_modules/
    composer install --no-dev
    rm -rf tests/
    rm -rf .git
    rm -rf .gitignore 
    rm -rf .github/
    rm -rf .husky/
    rm -rf composer.*
    rm -rf package*  
    rm -rf php*
    rm -rf .phpunit.result.cache 
    rm -rf README.md 
    rm -rf screenshot-1.png

}

function replace_version_number() {
  # Check if version number is provided
  if [ -z "$1" ]; then
    echo "Usage: replace_version_number <version_number>"
    return 1
  fi

  VERSION=$1

  # Function to traverse directories and replace {VERSION} with the real version number
  traverse_and_replace() {
    for file in "$1"/*; do
      if [ -d "$file" ]; then
        # Skip /vendor and /node_modules directories
        if [[ "$file" == */vendor ]] || [[ "$file" == */node_modules ]]; then
          continue
        fi
        # Recursively traverse directories
        traverse_and_replace "$file"
      elif [ -f "$file" ]; then
        # Replace {VERSION} with the real version number in files
        sed -i "s/{VERSION}/$VERSION/g" "$file"
      fi
    done
  }

  # Start traversal from the current working directory
  traverse_and_replace "."

  echo "Replaced {VERSION} with $VERSION in all files."
}

You have wc-price-history-svn directory where you have the whole svn copy (it has wc-price-history and trunk, tags inside)

Steps

everything you have merged into develop branch

plugin.php has updated version number in a header

plugin.php has updated version number in constant WC_PRICE_HISTORY_VERSION

All {VERSION} tags in code are replaced with real version number

Run from the main plugin directory:

replace_version_number 2.1

readme.txt has correct Stable tag

readme.txt has updated Tested up to

readme.txt has updated Changelog section

readme.txt has updated FAQ section and description

README.md has optionally updated content

go to directory where wc-price-history-svn is

run wc_price_update_svn_trunk

check if you have a new files with svn status | grep ?

add each new file with svn add {path}

push changes to the svn

svn ci -m "Pushing x.x.x to the trunk"

check the trunk

In other terminal in other directory run:

svn co https://plugins.svn.wordpress.org/wc-price-history

go to cloned directory, get trunk directory and move to some sites' plugins directory and test if plugin works.

tag new version

Go back to previous directory and run:

svn cp trunk/ tags/{x.x.x}

and run:

svn ci -m "Tagging 2.0.0"

Download zip and test it on some site

Do the release on GH

  • create it from develop as new tag
  • copy changelog as release description
  • upload downloaded zip

Visit forum and inform everyone waiting for the release about it

Update translations

https://translate.wordpress.org/projects/wp-plugins/wc-price-history/