Skip to content

Commit 7ab7020

Browse files
authored
Merge pull request #14 from codeboxrcodehub/dev
version 1.0.9 released
2 parents 67e49b4 + 7455621 commit 7ab7020

File tree

7 files changed

+137
-53
lines changed

7 files changed

+137
-53
lines changed

.distignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.wordpress-org
2+
/.git
3+
/.github
4+
/node_modules
5+
6+
.distignore
7+
.gitignore
8+
.gitattributes

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Directories
2+
/.wordpress-org export-ignore
3+
/.github export-ignore
4+
5+
# Files
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore

.github/workflows/deploy.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Deploy to GitHub
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- "*"
9+
10+
jobs:
11+
tag:
12+
name: Prepare Release
13+
runs-on: ubuntu-latest
14+
if: github.event_name == 'push' # Only run on push events
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0 # Important: Fetch all history for tags
20+
21+
- name: Get latest commit SHA
22+
id: sha
23+
if: github.ref == 'refs/heads/master' # Only when pushing to master
24+
run: echo "::set-output name=sha::$(git rev-parse HEAD)"
25+
26+
- name: Create Tag (if needed)
27+
id: create_tag
28+
if: github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'Merge pull request') #Only on direct pushes to master, not merge commits
29+
run: |
30+
TAG_NAME="v$(date +%Y%m%d%H%M%S)-${{ steps.sha.outputs.sha }}"
31+
git config --global user.name 'GitHub Actions'
32+
git config --global user.email 'actions@github.com'
33+
git tag -a "$TAG_NAME" -m "Release from master ${{ steps.sha.outputs.sha }}"
34+
git push origin --tags
35+
echo "::set-output name=tag::$TAG_NAME"
36+
37+
- name: Extract Release Notes
38+
id: release_notes
39+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
40+
run: |
41+
# Define variables
42+
changelog_section_start="== Changelog =="
43+
current_tag="${{ steps.create_tag.outputs.tag || github.ref_name }}" # Use created tag or existing tag
44+
readme_file=$(find . -type f -iname "readme.*" | head -n 1)
45+
46+
if [ -z "$readme_file" ]; then
47+
echo "::error::Readme file not found."
48+
exit 1
49+
fi
50+
echo "Readme file: $readme_file"
51+
52+
# Extract version from tag
53+
version=${current_tag#refs/tags/}
54+
55+
# Initialize variables
56+
in_changelog=0
57+
capturing_version=0
58+
release_notes=""
59+
60+
while IFS= read -r line; do
61+
# Start capturing after finding the changelog section
62+
if [[ "$line" == "$changelog_section_start" ]]; then
63+
in_changelog=1
64+
continue
65+
fi
66+
67+
# Skip lines before the changelog section
68+
if [[ $in_changelog -eq 0 ]]; then
69+
continue
70+
fi
71+
72+
# Start capturing if the line starts with a version number (semver format)
73+
if [[ "$line" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
74+
capturing_version=1
75+
# Check if the captured version matches the current tag
76+
if [[ "$line" == "$version" ]]; then
77+
release_notes+="$line\n"
78+
fi
79+
continue
80+
fi
81+
82+
# Stop capturing when a new version section is detected
83+
if [[ $capturing_version -eq 1 && "$line" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
84+
break
85+
fi
86+
87+
# Add the line to the release notes if capturing the current version
88+
if [[ $capturing_version -eq 1 ]]; then
89+
release_notes+="$line\n"
90+
fi
91+
done < "$readme_file"
92+
93+
# Check if release notes were extracted
94+
if [[ -z "$release_notes" ]]; then
95+
echo "::error::Failed to extract release notes for version $version."
96+
exit 1
97+
fi
98+
99+
# Debug: Print extracted release notes
100+
echo "Extracted release notes for version $version:"
101+
printf "%b" "$release_notes"
102+
103+
# Set output for release notes
104+
echo "::set-output name=notes::$(printf "%b" "$release_notes")"
105+
106+
- name: Create GitHub Release
107+
uses: softprops/action-gh-release@v2
108+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
109+
with:
110+
tag_name: ${{ steps.create_tag.outputs.tag || github.ref_name }}
111+
body: ${{ steps.release_notes.outputs.notes }}
112+
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
113+
env:
114+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Whitespace-only changes.

README.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

README.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: codeboxr, manchumahara
33
Requires at least: 5.3
44
Tested up to: 6.7.1
5-
Stable tag: 1.0.8
5+
Stable tag: 1.0.9
66
License: MIT
77
License URI: https://github.com/codeboxrcodehub/cbxphpspreadsheet/blob/master/LICENSE.txt
88

@@ -20,7 +20,7 @@ Software requirements
2020

2121
The following software is required to develop using PhpSpreadsheet:
2222

23-
* PHP version 7.4 or newer
23+
* PHP version 8.1 or newer
2424
* PHP extension php_zip enabled
2525
* PHP extension php_xml enabled
2626
* PHP extension php_gd2 enabled (if not compiled in)
@@ -52,6 +52,9 @@ if ( defined('CBXPHPSPREADSHEET_PLUGIN_NAME') && cbxphpspreadsheet_loadable() )
5252

5353

5454
== Changelog ==
55+
= 1.0.9 =
56+
* Fixed function 'php_version_check'
57+
5558
= 1.0.8 =
5659
* Dependency vendor packages updated to latest
5760
* Added some helper functions for better environment checking

cbxphpspreadsheet.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Plugin Name: CBX PhpSpreadSheet Library
1717
* Plugin URI: https://codeboxr.com/php-spreadsheet-library-wordpress-plugin/
1818
* Description: A pure PHP library for reading and writing spreadsheet files https://phpspreadsheet.readthedocs.io/
19-
* Version: 1.0.8
19+
* Version: 1.0.9
2020
* Requires PHP: 8.1.99
2121
* Author: Codeboxr
2222
* Author URI: https://github.com/PHPOffice/PhpSpreadsheet
@@ -33,7 +33,7 @@
3333
}
3434

3535
defined( 'CBXPHPSPREADSHEET_PLUGIN_NAME' ) or define( 'CBXPHPSPREADSHEET_PLUGIN_NAME', 'cbxphpspreadsheet' );
36-
defined( 'CBXPHPSPREADSHEET_PLUGIN_VERSION' ) or define( 'CBXPHPSPREADSHEET_PLUGIN_VERSION', '1.0.8' );
36+
defined( 'CBXPHPSPREADSHEET_PLUGIN_VERSION' ) or define( 'CBXPHPSPREADSHEET_PLUGIN_VERSION', '1.0.9' );
3737
defined( 'CBXPHPSPREADSHEET_BASE_NAME' ) or define( 'CBXPHPSPREADSHEET_BASE_NAME', plugin_basename( __FILE__ ) );
3838
defined( 'CBXPHPSPREADSHEET_ROOT_PATH' ) or define( 'CBXPHPSPREADSHEET_ROOT_PATH', plugin_dir_path( __FILE__ ) );
3939
defined( 'CBXPHPSPREADSHEET_ROOT_URL' ) or define( 'CBXPHPSPREADSHEET_ROOT_URL', plugin_dir_url( __FILE__ ) );
@@ -109,8 +109,7 @@ public function activation_error_display() {
109109
* @return bool
110110
*/
111111
private static function php_version_check() {
112-
//return version_compare( PHP_VERSION, '8.1.99', '>=' );
113-
return false;
112+
return version_compare( PHP_VERSION, '8.1.99', '>=' );
114113
}//end method php_version_check
115114

116115
/**

0 commit comments

Comments
 (0)