Bump version to 1.1.1 and migrate to PolyForm Noncommercial License

- **Version Update**: Bump version from 1.1.0 to 1.1.1 across all files
- **License Migration**: Updated from GPL v2.0+ to PolyForm Noncommercial 1.0.0
- **Updated Files**:
  - composer.json: version and license identifier
  - LICENSE.md: complete license text replacement
  - README.md: license badge and documentation updates
  - src/Updater.php & src/UpdaterConfig.php: @license and @version tags
  - GitHub Actions workflow: license references
  - Copilot instructions: license information
- **Added Tools**:
  - scripts/update-version-simple.sh: automated version management script
  - .gitattributes: exclude development files from Composer distribution
- **CHANGELOG**: Convert [Unreleased] section to [1.1.1] with license changes
This commit is contained in:
Miguel Colmenares 2025-08-14 21:25:53 -05:00
parent 54c2cf2d2f
commit e0a60e545e
10 changed files with 334 additions and 63 deletions

3
.gitattributes vendored
View file

@ -7,4 +7,5 @@
/phpcs.xml export-ignore
/phpstan.neon export-ignore
/tests export-ignore
/CHANGELOG.md export-ignore
/scripts export-ignore
/composer.lock export-ignore

View file

@ -28,7 +28,7 @@ wp-github-updater/
├── composer.json # Package definition
├── README.md # Documentation
├── CHANGELOG.md # Version history
├── LICENSE.md # GPL v2.0 license
├── LICENSE.md # PolyForm Noncommercial 1.0.0 license
├── phpcs.xml # Code standards
├── phpstan.neon # Static analysis
└── phpunit.xml # Test configuration

View file

@ -137,7 +137,7 @@ jobs:
- **Package Name**: wp-github-updater
- **Version**: $VERSION
- **Namespace**: SilverAssist\\WpGithubUpdater
- **License**: MIT
- **License**: PolyForm Noncommercial 1.0.0
- **PHP Version**: 8.0+
- **WordPress Version**: 6.0+
@ -199,7 +199,7 @@ jobs:
- **Package Name**: wp-github-updater
- **Version**: $VERSION
- **Release Date**: $DATE
- **License**: MIT
- **License**: PolyForm Noncommercial 1.0.0
- **Repository**: https://github.com/SilverAssist/wp-github-updater
## Package Contents

View file

@ -1,5 +1,11 @@
# Changelog
## [1.1.1] - 2025-08-14
### Changed
- **License Migration**: Updated from GPL v2.0+ to PolyForm Noncommercial 1.0.0
- **License References**: Updated all references in composer.json, README.md, source files, and GitHub Actions workflow
- **License Documentation**: Updated license badges and documentation to reflect noncommercial licensing
## [1.1.0] - 2025-08-12
### Added
- **Configurable text domain support**: New `text_domain` option in `UpdaterConfig` constructor for internationalization flexibility

View file

@ -1,61 +1,25 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Polyform Noncommercial License 1.0.0
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Acceptance
In order to receive this license, you must agree to its rules. The rules of this license are both obligations under that agreement and conditions to your license. You must not do anything with the licensed material that triggers a rule you cannot or will not follow.
For details, see https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
Copyright License
The licensor grants you a copyright license for the licensed material to do everything you might do with the licensed material that would otherwise infringe the licensors copyright in it, for any noncommercial purpose, for the duration of the license, and in all territories. This license does not grant you rights to use the licensed material for commercial purposes.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Commercial Purposes
Commercial purposes means use of the licensed material for a purpose intended for or directed toward commercial advantage or monetary compensation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Distribution and Modification
You may distribute copies of the licensed material, in whole or in part, in any medium, and you may create and distribute modified versions of the licensed material, provided that you (a) do not use the licensed material for commercial purposes, and (b) include a complete copy of this license with your distribution.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Patent License
The licensor grants you a patent license for the licensed material to make, have made, use, sell, offer for sale, and import the licensed material for any noncommercial purpose, for the duration of the license, and in all territories. This license does not grant you rights to use the licensed material for commercial purposes.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
No Other Rights
These terms do not grant you any other rights in the licensed material, and all other rights are reserved by the licensor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Termination
If you use the licensed material in violation of this license, such use will automatically terminate your rights under this license. However, if you comply with this license after such violation, your rights will be reinstated unless the licensor has terminated this license by giving you written notice.
Copyright (c) 2025 Silver Assist
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
No Liability
As far as the law allows, the licensed material comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages related to this license or use of the licensed material, under any kind of legal claim.

View file

@ -1,7 +1,7 @@
# WordPress GitHub Updater
[![Latest Version on Packagist](https://img.shields.io/packagist/v/silverassist/wp-github-updater.svg?style=flat-square)](https://packagist.org/packages/silverassist/wp-github-updater)
[![Software License](https://img.shields.io/badge/license-GPLv2-blue.svg?style=flat-square)](LICENSE.md)
[![Software License](https://img.shields.io/badge/license-PolyForm--Noncommercial--1.0.0-blue.svg?style=flat-square)](LICENSE.md)
[![Total Downloads](https://img.shields.io/packagist/dt/silverassist/wp-github-updater.svg?style=flat-square)](https://packagist.org/packages/silverassist/wp-github-updater)
A reusable WordPress plugin updater that handles automatic updates from public GitHub releases. Perfect for WordPress plugins distributed outside the official repository.
@ -229,7 +229,7 @@ composer check
## License
This package is licensed under the GNU General Public License v2.0 or later (GPL-2.0-or-later). Please see [License File](LICENSE.md) for more information.
This package is licensed under the Polyform Noncommercial License 1.0.0 (PolyForm-Noncommercial-1.0.0). This license allows for non-commercial use, modification, and distribution. Please see [License File](LICENSE.md) for more information.
## Credits

View file

@ -1,7 +1,7 @@
{
"name": "silverassist/wp-github-updater",
"description": "A reusable WordPress plugin updater that handles automatic updates from public GitHub releases",
"version": "1.1.0",
"version": "1.1.1",
"type": "library",
"keywords": [
"wordpress",
@ -11,7 +11,7 @@
"auto-update"
],
"homepage": "https://github.com/SilverAssist/wp-github-updater",
"license": "GPL-2.0-or-later",
"license": "PolyForm-Noncommercial-1.0.0",
"authors": [
{
"name": "Silver Assist",

298
scripts/update-version-simple.sh Executable file
View file

@ -0,0 +1,298 @@
#!/bin/bash
# WP GitHub Updater - Version Update Script
# Updates version numbers across all project files consistently
set -e # Exit on any error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Configuration
PROJECT_NAME="WP GitHub Updater"
COMPOSER_FILE="composer.json"
README_FILE="README.md"
CHANGELOG_FILE="CHANGELOG.md"
PHP_SOURCE_DIR="src"
# Function to display usage
usage() {
echo -e "${BLUE}Usage: $0 <version> [--no-confirm]${NC}"
echo ""
echo "Examples:"
echo " $0 1.1.1 # Update to version 1.1.1 with confirmation"
echo " $0 1.2.0 --no-confirm # Update to version 1.2.0 without confirmation (for CI)"
echo ""
echo "This script will update version numbers in:"
echo " - composer.json"
echo " - README.md (if version references exist)"
echo " - CHANGELOG.md (if unreleased section exists)"
exit 1
}
# Function to validate version format
validate_version() {
local version=$1
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo -e "${RED}Error: Version must be in format X.Y.Z (e.g., 1.2.3)${NC}"
exit 1
fi
}
# Function to get current version from composer.json
get_current_version() {
if [[ -f "$COMPOSER_FILE" ]]; then
grep '"version"' "$COMPOSER_FILE" | head -n1 | sed 's/.*"version": *"\([^"]*\)".*/\1/'
else
echo "unknown"
fi
}
# Function to update composer.json
update_composer_version() {
local new_version=$1
if [[ -f "$COMPOSER_FILE" ]]; then
echo -e "${YELLOW}Updating $COMPOSER_FILE...${NC}"
# Create backup
cp "$COMPOSER_FILE" "${COMPOSER_FILE}.backup"
# Update version using sed
sed -i.tmp "s/\"version\": *\"[^\"]*\"/\"version\": \"$new_version\"/" "$COMPOSER_FILE"
rm "${COMPOSER_FILE}.tmp"
echo -e "${GREEN}✅ Updated composer.json version to $new_version${NC}"
else
echo -e "${RED}❌ composer.json not found${NC}"
exit 1
fi
}
# Function to update CHANGELOG.md if it has unreleased section
update_changelog_if_unreleased() {
local new_version=$1
local current_date=$(date +"%Y-%m-%d")
if [[ -f "$CHANGELOG_FILE" ]]; then
# Check if there's an [Unreleased] section
if grep -q "## \[Unreleased\]" "$CHANGELOG_FILE"; then
echo -e "${YELLOW}Updating CHANGELOG.md [Unreleased] section...${NC}"
# Create backup
cp "$CHANGELOG_FILE" "${CHANGELOG_FILE}.backup"
# Replace [Unreleased] with the new version and date
sed -i.tmp "s/## \[Unreleased\]/## [$new_version] - $current_date/" "$CHANGELOG_FILE"
rm "${CHANGELOG_FILE}.tmp"
echo -e "${GREEN}✅ Updated CHANGELOG.md [Unreleased] to [$new_version] - $current_date${NC}"
else
echo -e "${BLUE} No [Unreleased] section found in CHANGELOG.md, skipping${NC}"
fi
else
echo -e "${BLUE} CHANGELOG.md not found, skipping${NC}"
fi
}
# Function to update PHP source files
update_php_files() {
local new_version=$1
if [[ -d "$PHP_SOURCE_DIR" ]]; then
echo -e "${YELLOW}Updating PHP source files in $PHP_SOURCE_DIR/...${NC}"
# Find all PHP files in the source directory
local php_files
php_files=$(find "$PHP_SOURCE_DIR" -name "*.php" -type f)
if [[ -n "$php_files" ]]; then
while IFS= read -r file; do
if [[ -f "$file" ]]; then
# Create backup
cp "$file" "${file}.backup"
# Update @version tags in PHP files
if grep -q "@version" "$file"; then
sed -i.tmp "s/@version [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/@version $new_version/" "$file"
rm "${file}.tmp"
echo -e "${GREEN} ✅ Updated @version in $(basename "$file")${NC}"
fi
# Update @since tags for the current version (if they exist)
if grep -q "@since $new_version" "$file"; then
echo -e "${BLUE} @since $new_version already present in $(basename "$file")${NC}"
fi
# Update version constants (if they exist)
if grep -q "VERSION.*=" "$file"; then
sed -i.tmp "s/VERSION.*=.*['\"][0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*['\"];/VERSION = \"$new_version\";/" "$file"
rm "${file}.tmp"
echo -e "${GREEN} ✅ Updated VERSION constant in $(basename "$file")${NC}"
fi
fi
done <<< "$php_files"
else
echo -e "${BLUE} No PHP files found in $PHP_SOURCE_DIR${NC}"
fi
else
echo -e "${BLUE} Directory $PHP_SOURCE_DIR not found, skipping PHP files update${NC}"
fi
}
# Function to show what will be updated
show_changes_preview() {
local current_version=$1
local new_version=$2
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}$PROJECT_NAME - Version Update Preview${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
echo -e "Current version: ${YELLOW}$current_version${NC}"
echo -e "New version: ${GREEN}$new_version${NC}"
echo ""
echo "Files that will be updated:"
if [[ -f "$COMPOSER_FILE" ]]; then
echo -e " ${GREEN}${NC} $COMPOSER_FILE"
fi
if [[ -f "$CHANGELOG_FILE" ]] && grep -q "## \[Unreleased\]" "$CHANGELOG_FILE"; then
echo -e " ${GREEN}${NC} $CHANGELOG_FILE (convert [Unreleased] to [$new_version])"
else
echo -e " ${YELLOW}${NC} $CHANGELOG_FILE (no [Unreleased] section found)"
fi
# Show PHP files that will be updated
if [[ -d "$PHP_SOURCE_DIR" ]]; then
local php_files
php_files=$(find "$PHP_SOURCE_DIR" -name "*.php" -type f)
if [[ -n "$php_files" ]]; then
echo -e " ${GREEN}${NC} PHP files in $PHP_SOURCE_DIR/:"
while IFS= read -r file; do
echo -e " - $(basename "$file")"
done <<< "$php_files"
fi
fi
echo ""
}
# Function to confirm changes
confirm_changes() {
local skip_confirm=$1
if [[ "$skip_confirm" != "true" ]]; then
echo -e "${YELLOW}Do you want to proceed with these changes? (y/N): ${NC}"
read -r response
if [[ ! "$response" =~ ^[Yy]$ ]]; then
echo -e "${RED}Update cancelled.${NC}"
exit 0
fi
fi
}
# Function to restore backups on error
cleanup_on_error() {
echo -e "${RED}An error occurred. Restoring backups...${NC}"
if [[ -f "${COMPOSER_FILE}.backup" ]]; then
mv "${COMPOSER_FILE}.backup" "$COMPOSER_FILE"
echo -e "${GREEN}Restored composer.json${NC}"
fi
if [[ -f "${CHANGELOG_FILE}.backup" ]]; then
mv "${CHANGELOG_FILE}.backup" "$CHANGELOG_FILE"
echo -e "${GREEN}Restored CHANGELOG.md${NC}"
fi
# Restore PHP file backups
if [[ -d "$PHP_SOURCE_DIR" ]]; then
local php_backups
php_backups=$(find "$PHP_SOURCE_DIR" -name "*.php.backup" -type f 2>/dev/null || true)
if [[ -n "$php_backups" ]]; then
while IFS= read -r backup_file; do
if [[ -f "$backup_file" ]]; then
local original_file="${backup_file%.backup}"
mv "$backup_file" "$original_file"
echo -e "${GREEN}Restored $(basename "$original_file")${NC}"
fi
done <<< "$php_backups"
fi
fi
exit 1
}
# Function to clean up successful backups
cleanup_backups() {
rm -f "${COMPOSER_FILE}.backup"
rm -f "${CHANGELOG_FILE}.backup"
# Clean up PHP file backups
if [[ -d "$PHP_SOURCE_DIR" ]]; then
find "$PHP_SOURCE_DIR" -name "*.php.backup" -type f -delete 2>/dev/null || true
fi
}
# Main script
main() {
local new_version=$1
local no_confirm=$2
# Check if version is provided
if [[ -z "$new_version" ]]; then
usage
fi
# Validate version format
validate_version "$new_version"
# Get current version
local current_version
current_version=$(get_current_version)
# Set up error handler
trap cleanup_on_error ERR
# Show preview
show_changes_preview "$current_version" "$new_version"
# Confirm changes
confirm_changes "$no_confirm"
# Update files
echo -e "${BLUE}Updating version to $new_version...${NC}"
echo ""
update_composer_version "$new_version"
update_changelog_if_unreleased "$new_version"
update_php_files "$new_version"
# Clean up backups on success
cleanup_backups
echo ""
echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN}✅ Version update completed successfully!${NC}"
echo -e "${GREEN}========================================${NC}"
echo ""
echo -e "${BLUE}Next steps:${NC}"
echo "1. Review the changes: git diff"
echo "2. Commit the changes: git add . && git commit -m \"Bump version to $new_version\""
echo "3. Create a tag: git tag -a v$new_version -m \"Release v$new_version\""
echo "4. Push changes: git push origin main --tags"
echo ""
}
# Parse arguments
if [[ "$2" == "--no-confirm" ]]; then
main "$1" "true"
else
main "$1" "false"
fi

View file

@ -7,7 +7,8 @@
*
* @package SilverAssist\WpGithubUpdater
* @author Silver Assist
* @license GPL-2.0-or-later
* @version 1.1.1
* @license PolyForm-Noncommercial-1.0.0
*/
namespace SilverAssist\WpGithubUpdater;

View file

@ -7,7 +7,8 @@
*
* @package SilverAssist\WpGithubUpdater
* @author Silver Assist
* @license GPL-2.0-or-later
* @version 1.1.1
* @license PolyForm-Noncommercial-1.0.0
*/
namespace SilverAssist\WpGithubUpdater;