Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
e159f34
composer update
navjottomer Apr 28, 2024
421c3dc
Refactor Gruntfile.js and package.json for improved build process
navjottomer Apr 28, 2024
ae64ed0
Refactor TinyMCE initialization in multiple files, updated bootstrap …
navjottomer May 1, 2024
d04dec3
Update Docker Compose configuration for Osclass Application
navjottomer May 10, 2024
f616af6
Refactor configuration files and installation functions in Osclass
navjottomer May 10, 2024
5a05118
handle DB errors in DBCommandClass.php and DBConnectionClass.php
navjottomer May 10, 2024
de63ad3
[CodeFactor] Apply fixes to commit f616af6
code-factor May 10, 2024
d1068c9
Update GitHub Actions workflow for release tagging and version extrac…
navjottomer Jan 22, 2025
961820c
Fix GitHub Actions workflow to ensure proper tag existence check for …
navjottomer Jan 22, 2025
f664b5c
Update GitHub Actions workflows to use latest actions and improve tag…
navjottomer Jan 22, 2025
1e1e070
Add debug step for OSCLASS_VERSION in build workflow
navjottomer Jan 22, 2025
0ca891c
Refactor GitHub Actions workflow to improve OSCLASS_VERSION extractio…
navjottomer Jan 22, 2025
8fa26f1
Configure Git user for automated release tagging in build workflow
navjottomer Jan 22, 2025
bfcdcda
Fix SQL query in Item model to correct WHERE clause formatting
navjottomer Feb 6, 2025
cde5a96
fix mysql exception: BIGINT UNSIGNED value is out of range on negativ…
navjottomer Feb 6, 2025
18713b1
Fix SQL syntax in Item model for date_add function and update method
navjottomer Feb 6, 2025
35c8e39
Update OSCLASS_VERSION to 5.2.1
navjottomer Feb 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 55 additions & 87 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,103 +1,71 @@
name: Release Workflow

on:
push:
branches:
- develop
permissions:
contents: write
pull-requests: write
issues: write
jobs:
create_release_branch_and_tag:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get commit message and extract version
id: get_commit_message
- name: Checkout Code
uses: actions/checkout@v4
- name: Extract OSCLASS_VERSION
id: extract_version
run: |
MESSAGE=$(git log --format=%B -n 1 ${{ github.sha }})
echo "MESSAGE=$MESSAGE" >> $GITHUB_ENV
if [[ $MESSAGE =~ \[release-([0-9]+\.[0-9]+\.[0-9])+\.{0,1}([dev|rc|beta[0-9]*)?\] ]]; then
echo "Release string found in the commit message."
BASE_VERSION="${BASH_REMATCH[1]}"
SUB_VERSION="${BASH_REMATCH[2]}"
SUB_SUB_VERSION="${BASH_REMATCH[3]}"
VERSION=${SUB_VERSION:+$BASE_VERSION.$SUB_VERSION}
VERSION=${VERSION:-$BASE_VERSION}
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV
echo "SUB_VERSION=$SUB_VERSION" >> $GITHUB_ENV
echo "SUB_SUB_VERSION=$SUB_SUB_VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
else
echo "No release string found in the commit message."
fi
- name: setup git config
if: env.VERSION != null
id: setup_git
run: |
# setup the username and email.'GitHub Actions Bot' with no email by default
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Create branch/tag
if: env.VERSION != null
id: create_branch
RAW_VERSION=$(grep -oP "(?<=define\\('OSCLASS_VERSION', ')[^']+" oc-includes/osclass/default-constants.php)
# Validate version and extract major.minor.patch and optional suffix
if [[ "${RAW_VERSION}" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(\.(dev[0-9]*|beta[0-9]*|rc[0-9]*))?$ ]]; then
BASE_VERSION="${BASH_REMATCH[1]}"
SUFFIX="${BASH_REMATCH[2]}"
echo "OSCLASS_VERSION=${RAW_VERSION}" >> $GITHUB_ENV
echo "BASE_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
echo "SUFFIX=${SUFFIX}" >> $GITHUB_ENV
echo "Extracted version: ${RAW_VERSION}, Base: ${BASE_VERSION}, Suffix: ${SUFFIX}"
else
echo "Invalid OSCLASS_VERSION format: ${RAW_VERSION}"
exit 1
fi

- name: Debug OSCLASS_VERSION
run: echo "OSCLASS_VERSION=${{ env.OSCLASS_VERSION }}"

- name: Check if Tag Exists
id: check_tag
shell: bash
run: |
echo "Base version: $BASE_VERSION"
echo "Sub version: $SUB_VERSION"
echo "Sub sub version: $SUB_SUB_VERSION"
echo "Version: $VERSION"

# Create release branch if not dev and release branch does not exist
git fetch --tags --quiet
if git tag --list "${OSCLASS_VERSION}" | grep -q "^${OSCLASS_VERSION}$"; then
echo "Tag ${OSCLASS_VERSION} already exists. Skipping release."
echo "TAG_EXISTS=true" >> $GITHUB_ENV
else
echo "Tag ${OSCLASS_VERSION} does not exist. Proceeding with release."
echo "TAG_EXISTS=false" >> $GITHUB_ENV
fi

- name: Stop if Tag Exists
if: ${{ env.TAG_EXISTS == 'true' }}
run: echo "Tag already exists. Exiting."

if [[ $SUB_VERSION != "dev" ]]; then
# check if release branch already exists
if git show-ref --verify --quiet refs/heads/release/$BASE_VERSION; then
echo "Release branch already exists."
# checkout release branch and merge develop branch
git pull origin release/$BASE_VERSION
git checkout release/$BASE_VERSION
git merge develop
else
git checkout -b release/$BASE_VERSION
fi
fi

# Update version in codebase
sed -i -E "s/define\('OSCLASS_VERSION.+\);/define('OSCLASS_VERSION', '$VERSION');/" oc-includes/osclass/default-constants.php

# Commit changes if changes were made
if [[ $(git status --porcelain) ]]; then
git add oc-includes/osclass/default-constants.php
git commit -m "Update version to $VERSION"
fi

# Push changes and create tag
git push origin HEAD
git tag -a $VERSION -m "Release $VERSION"
git push origin $VERSION

# Determine if pre-release dev release
PRERELEASE=false
if [[ $SUB_VERSION =~ (dev|rc|beta) ]]; then
PRERELEASE=true
fi
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV

- name: Create GitHub Release Archive
if: env.VERSION != null
- name: Create Release Tag
if: ${{ env.TAG_EXISTS == 'false' }}
run: |
sh ./.build.sh
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git tag -a "${OSCLASS_VERSION}" -m "Release ${OSCLASS_VERSION}"
git push origin "${OSCLASS_VERSION}"

- name: Run Build Script
if: ${{ env.TAG_EXISTS == 'false' }}
run: sh ./.build.sh

- name: Create GitHub Release
#Only create a release if the version is dev
if: env.VERSION != null
uses: softprops/action-gh-release@v1
if: ${{ env.TAG_EXISTS == 'false' }}
uses: softprops/action-gh-release@v2
with:
files: release/osclass_v${{ env.VERSION }}.zip
tag_name: ${{ env.BASE_VERSION }}
name: Release ${{ env.BASE_VERSION }}
draft: true
prerelease: ${{ env.PRERELEASE }}
files: release/osclass_v${{ env.OSCLASS_VERSION }}.zip
tag_name: ${{ env.OSCLASS_VERSION }}
name: Release ${{ env.OSCLASS_VERSION }}
prerelease: ${{ env.SUFFIX != '' }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4','8.0', '8.1', '8.2', '8.3' ]
php-versions: ['8.2', '8.3', '8.4' ]
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
Expand Down
52 changes: 29 additions & 23 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*
* grunt-js
*/

module.exports = function (grunt) {
'use strict';

var assetsDir = 'oc-includes/assets',
nodeDir = 'node_modules';
// Define directories
var assetsDir = 'oc-includes/assets';
var nodeDir = 'node_modules';

// Load all grunt tasks
require('load-grunt-tasks')(grunt);

// Project configuration
grunt.initConfig({
clean: {
vendors: [assetsDir, 'oc-admin/themes/modern/scss/bootstrap']
Expand Down Expand Up @@ -130,6 +131,20 @@ module.exports = function (grunt) {
dest: assetsDir + '/tinymce',
flatten: false
},
{
expand: true,
cwd: nodeDir + '/tinymce/models/dom',
src: ['**/*.min.js'],
dest: assetsDir + '/tinymce/models/dom',
flatten: false
},
{
expand: true,
cwd: nodeDir + '/tinymce/skins',
src: ['content/default/content.min.css', 'ui/oxide/skin.min.css'],
dest: assetsDir + '/tinymce/skins',
flatten: false
},
{
expand: true,
cwd: nodeDir + '/tinymce/plugins',
Expand Down Expand Up @@ -208,10 +223,11 @@ module.exports = function (grunt) {
}
},
sass: {
options: {
implementation: require('node-sass'),
style: 'nested'
},
dist: {
options: {
style: 'nested'
},
files: {
'oc-admin/themes/modern/css/main.css':
'oc-admin/themes/modern/scss/main.scss'
Expand All @@ -228,27 +244,17 @@ module.exports = function (grunt) {
}
}
}

});

// Custom task to create assets directory if not exists
grunt.registerTask('createAssetsDir', 'Creates the necessary static assets directory', function () {
// Create the assets dir when it doesn't exists.
if (!grunt.file.isDir(assetsDir)) {
grunt.file.mkdir(assetsDir);

// Output a success message
grunt.log.ok(grunt.template.process(
'Directory "<%= directory %>" was created successfully.',
{data: {directory: assetsDir}}
));
grunt.log.ok('Directory "' + assetsDir + '" was created successfully.');
}
});

// Define tasks
grunt.registerTask('default', ['clean', 'createAssetsDir', 'copy', 'sass', 'uglify']);
grunt.registerTask('compile', ['sass']);
grunt.registerTask('uglify',['uglify']);
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-uglify');
};
};
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@
"ext-fileinfo": "*",
"ext-mbstring": "*",
"ext-gd": "*",
"ezyang/htmlpurifier": "4.15.*",
"ezyang/htmlpurifier": "4.17.*",
"phpmailer/phpmailer": "6.5.*",
"pclzip/pclzip": "2.8.*",
"phpseclib/phpseclib": "2.0.*",
"pensiero/php-openssl-cryptor": "0.1.*",
"google/recaptcha": "1.1.*",
"gettext/gettext": "4.8.*",
"phpseclib/mcrypt_compat": "^1.0",
"ext-imagick": "*"
"phpseclib/mcrypt_compat": "^1.0"
}
,
"require-dev": {
"roave/security-advisories": "dev-latest"
},
"suggest": {
"ext-apcu": "Fast PHP user cache",
"ext-memcache": "Will enable to communicate with memcached server"
"ext-memcache": "Will enable to communicate with memcached server",
"ext-imagick": "Will enable to use Imagick library for image manipulation"
}
}
Loading