Skip to content

Commit 7eadd46

Browse files
committed
version 1.0.1 ready for release
1 parent e92761c commit 7eadd46

File tree

10 files changed

+225
-272
lines changed

10 files changed

+225
-272
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: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*' # Match semantic versioning tags
7+
# Removed branches trigger to ensure it only runs on tags
8+
# branches:
9+
# - master
10+
11+
jobs:
12+
create_release:
13+
# No need to check against branches, workflow only triggers on tags
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Find Readme File
21+
id: find_readme
22+
run: |
23+
for file in readme.txt Readme.txt README.txt README.md Readme.md readme.md; do
24+
if [ -f "$file" ]; then
25+
echo "Readme file found: $file"
26+
echo "readme_file=$file" >> $GITHUB_ENV
27+
break
28+
fi
29+
done
30+
31+
# Ensure the variable is available within the current step
32+
source $GITHUB_ENV
33+
34+
if [ -z "$readme_file" ]; then
35+
echo "::error::Readme file not found."
36+
exit 1
37+
fi
38+
39+
- name: Extract Release Notes
40+
id: release_notes
41+
run: |
42+
changelog_section_start="== Changelog =="
43+
readme_file="$readme_file"
44+
45+
# Extract the tag name from GITHUB_REF (plugin_version)
46+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
47+
plugin_version="${GITHUB_REF#refs/tags/}"
48+
echo "DEBUG: Plugin latest version found: $plugin_version."
49+
else
50+
echo "::error::This workflow must be triggered by a tag push."
51+
exit 1
52+
fi
53+
54+
in_changelog=0
55+
found_version=0
56+
release_notes=""
57+
58+
echo "DEBUG: Starting to extract release notes from $readme_file for version $plugin_version."
59+
60+
while IFS= read -r line; do
61+
echo "DEBUG: Processing line: $line"
62+
63+
# Start processing after the changelog header
64+
if [[ "$line" == "$changelog_section_start" ]]; then
65+
in_changelog=1
66+
echo "DEBUG: Found changelog section header."
67+
continue
68+
fi
69+
70+
# Skip if not in changelog section
71+
if [[ $in_changelog -eq 0 ]]; then
72+
echo "DEBUG: Skipping line (not in changelog section)."
73+
continue
74+
fi
75+
76+
# Check for the current version header
77+
if [[ "$line" == "= ${plugin_version} =" ]]; then
78+
found_version=1
79+
echo "DEBUG: Found version header for $plugin_version."
80+
continue
81+
fi
82+
83+
# Break if a new version header is found after the current version
84+
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^= [0-9]+\.[0-9]+\.[0-9]+ =$'; then
85+
echo "DEBUG: Found a new version header. Stopping collection."
86+
break
87+
fi
88+
89+
# Collect lines starting with '*' if we are in the current version section
90+
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^\*'; then
91+
echo "DEBUG: Found changelog entry: $line"
92+
release_notes+="${line}\n"
93+
continue
94+
fi
95+
96+
# Log skipped lines in the current version section
97+
if [[ $found_version -eq 1 ]]; then
98+
echo "DEBUG: Skipping line (not a changelog entry): $line"
99+
fi
100+
done < "$readme_file"
101+
102+
if [[ -z "$release_notes" ]]; then
103+
echo "::error::Failed to extract release notes for version ${plugin_version}."
104+
exit 1
105+
fi
106+
107+
echo "DEBUG: Successfully extracted release notes."
108+
echo "DEBUG: Release notes content:"
109+
echo -e "$release_notes"
110+
111+
# Write the release notes with actual line breaks
112+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
113+
echo -e "$release_notes" >> $GITHUB_ENV
114+
echo "EOF" >> $GITHUB_ENV
115+
116+
- name: Create zip file
117+
run: |
118+
REPO_NAME=$(basename `git rev-parse --show-toplevel`)
119+
zip -r ${REPO_NAME}.zip . -x '*.git*' -x '.github/*' -x '*.distignore*' -x 'CHANGELOG.txt'
120+
echo "repo_name=${REPO_NAME}" >> $GITHUB_ENV
121+
122+
# Source to make repo_name available in subsequent steps
123+
source $GITHUB_ENV
124+
125+
- name: Create Release
126+
id: create_release
127+
uses: actions/create-release@v1
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
with:
131+
tag_name: ${{ github.ref_name }}
132+
release_name: "${{ github.ref_name }}"
133+
body: ${{ env.RELEASE_NOTES }}
134+
draft: false
135+
prerelease: false
136+
137+
- name: Upload Release Asset
138+
uses: actions/upload-release-asset@v1
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
with:
142+
upload_url: ${{ steps.create_release.outputs.upload_url }}
143+
asset_path: ./${{ env.repo_name }}.zip
144+
asset_name: ${{ env.repo_name }}.zip
145+
asset_content_type: application/zip

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
script.sh

README.md

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

cbxphpfpdf.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
* Plugin Name: CBX PHPFPDF Library
1717
* Plugin URI: https://github.com/codeboxrcodehub/cbxphpfpdf
1818
* Description: fpdf library as WordPress plugin based on https://github.com/fawno/FPDF
19-
* Version: 1.0.0
19+
* Version: 1.0.1
2020
* Author: Codeboxr
2121
* Author URI: https://github.com/PHPOffice/PhpDomPDF
22-
* License: GPL-2.0+
23-
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
22+
* License: MIT
23+
* License URI: https://github.com/codeboxrcodehub/cbxphpfpdf/blob/master/LICENSE.txt
2424
* Text Domain: cbxphpfpdf
2525
* Domain Path: /languages
2626
*/
@@ -29,10 +29,9 @@
2929
if (!defined('WPINC')) {
3030
die;
3131
}
32-
use Cbx\Phpfpdf\Hooks;
3332

3433
defined('CBXPHPFPDF_PLUGIN_NAME') or define('CBXPHPFPDF_PLUGIN_NAME', 'cbxphpfpdf');
35-
defined('CBXPHPFPDF_PLUGIN_VERSION') or define('CBXPHPFPDF_PLUGIN_VERSION', '1.0.0');
34+
defined('CBXPHPFPDF_PLUGIN_VERSION') or define('CBXPHPFPDF_PLUGIN_VERSION', '1.0.');
3635
defined('CBXPHPFPDF_BASE_NAME') or define('CBXPHPFPDF_BASE_NAME', plugin_basename(__FILE__));
3736
defined('CBXPHPFPDF_ROOT_PATH') or define('CBXPHPFPDF_ROOT_PATH', plugin_dir_path(__FILE__));
3837
defined('CBXPHPFPDF_ROOT_URL') or define('CBXPHPFPDF_ROOT_URL', plugin_dir_url(__FILE__));
@@ -106,7 +105,7 @@ public function activation_error_display() {
106105
* @return bool
107106
*/
108107
private static function php_version_check(){
109-
return version_compare( PHP_VERSION, '7.1.0', '>=' );
108+
return version_compare( PHP_VERSION, '7.4', '>=' );
110109
}//end method php_version_check
111110

112111
/**
@@ -188,7 +187,6 @@ function cbxphpfpdf_loadable(){
188187
function cbxphpfpdf_load(){
189188
if(CBXPhpFpdf::environment_ready()){
190189
require_once CBXPHPFPDF_ROOT_PATH . "lib/vendor/autoload.php";
191-
new Hooks();
192190
}
193191
}//end function cbxphpfpdf_load
194192
}

includes/Hooks.php

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

0 commit comments

Comments
 (0)