Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update addon to the new standards #10

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 30 additions & 9 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,39 @@ on:
release:
description: 'Release version (e.g. 1.2.3)'
required: true
prerelease:
description: 'Pre-release version (e.g. RC1, beta, etc...)'
required: false

permissions:
contents: write

env:
TAG: ${{ github.event.inputs.release }}
PRETAG: ${{ github.event.inputs.prerelease }}
BRANCH: temp-release-${{ github.event.inputs.release }}

jobs:
build:
runs-on: ubuntu-latest
steps:
# ref and repository are required, otherwise repo could appear in detached head state
- name: Prepare vars
id: vars
uses: actions/github-script@v7
with:
script: |
const full_tag = [
process.env.TAG,
process.env.PRETAG
].filter(Boolean).join('-');
const branch = `temp-release-${full_tag}`;
const is_prerelease = !!process.env.PRETAG;

core.setOutput('full_tag', full_tag );
core.setOutput('branch', branch );
core.setOutput('is_prerelease', is_prerelease );

# 'ref' and 'repository' are required, otherwise repo could appear in detached head state
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -65,6 +85,7 @@ jobs:
run: |
rm -f composer.lock || true
rm -rf tests || true
rm -rf vendor/bin || true
rm -rf vendor/composer/installers || true
find ./ -name '.git*' -not -path './.git' -type f -delete || true
find ./ -name '.git*' -not -path './.git' -type d -exec rm -rf {} \; || true
Expand All @@ -83,8 +104,8 @@ jobs:
uses: EndBug/add-and-commit@v9
with:
message: Cleanup files for release
new_branch: ${{ env.BRANCH }}
tag: ${{ env.TAG }}
new_branch: ${{ steps.vars.outputs.branch }}
tag: ${{ steps.vars.outputs.full_tag }}

# generate SBOM that will be attached to a release as an artifact
- name: Create SBOM
Expand All @@ -98,17 +119,17 @@ jobs:
# create a draft release with the version changelog as a description
- name: Create Draft Release
id: draft_release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
name: "Release ${{ env.TAG }}"
name: "Release ${{ steps.vars.outputs.full_tag }}"
body: "${{ steps.changelog.outputs.description }}"
tag_name: ${{ env.TAG }}
tag_name: ${{ steps.vars.outputs.full_tag }}
draft: true
prerelease: false
prerelease: ${{ steps.vars.outputs.is_prerelease }}

# attach SBOM to release
- name: Upload SBOM to release
uses: actions/[email protected].1
uses: actions/[email protected].2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -128,4 +149,4 @@ jobs:
# delete temporary release branch
- name: Delete temporary release branch
run: |
git push origin --delete ${{ env.BRANCH }}
git push origin --delete ${{ steps.vars.outputs.branch }}
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
== Changelog ==

= 0.0.2 =
* Updated release.

= 0.0.1 =
* Initial public release.
4 changes: 3 additions & 1 deletion changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#### 0.0.1
#### 0.0.2
* Updated release.

#### 0.0.1
- Initial public release.
1 change: 1 addition & 0 deletions class-buddyboss.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function module_init( $sm ) {
*/
public function skip_cache_busting( $return, $filename ) {
$info = pathinfo( $filename );
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace
$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 8 );
if( empty( $info[ 'extension' ] ) && strpos( $backtrace[ 6 ][ 'file' ], '/buddyboss-platform/' ) !== false ) {
return $filename;
Expand Down
12 changes: 7 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
=== WP-Stateless - BuddyBoss Platform Addon ===
Contributors: usability_dynamics, andypotanin, ideric, maxim.peshkov, planvova, obolgun
Contributors: usability_dynamics, andypotanin, ideric, planvova, obolgun
Donate link: https://udx.io
Tags: buddyboss, buddyboss platform, google, google cloud, google cloud storage, cdn, uploads, media, stateless, backup
Tags: buddyboss, buddyboss addon extension, google cloud storage, stateless, wp-stateless
License: GPLv2 or later
Requires PHP: 8.0
Requires at least: 5.0
Tested up to: 6.4.2
Stable tag: 0.0.1
Tested up to: 6.7.1
Stable tag: 0.0.2

Provides compatibility between the BuddyBoss Platform and the WP-Stateless plugin.

Expand Down Expand Up @@ -44,7 +44,9 @@ To ensure new releases cause as little disruption as possible, we rely on early

== Changelog ==

= 0.0.1 =
= 0.0.2 =
* Updated release.

= 0.0.1 =
* Initial public release.

9 changes: 9 additions & 0 deletions tests/ClassBuddyBossTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ public function testShouldInitHooks() {
self::assertNotFalse( has_filter('stateless_skip_cache_busting', [ $budyboss, 'skip_cache_busting' ]) );
}

public function testShouldCountHooks() {
$budyboss = new BuddyBoss();

Functions\expect('add_action')->times(0);
Functions\expect('add_filter')->times(1);

$budyboss->module_init([]);
}

public function testShouldSkipCacheBusting() {
$budyboss = new BuddyBoss();

Expand Down
12 changes: 6 additions & 6 deletions wp-stateless-buddyboss-addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
* Plugin URI: https://stateless.udx.io/addons/buddyboss
* Description: Provides compatibility between the BuddyBoss Platform and the WP-Stateless plugin.
* Author: UDX
* Version: 0.0.1
* Text Domain: slcabbp
* Version: 0.0.2
* Text Domain: wp-stateless-buddyboss-platform-addon
* Author URI: https://udx.io
* License: MIT
* License: GPLv2 or later
*
* Copyright 2024 UDX (email: [email protected])
* Copyright 2024-2025 UDX (email: [email protected])
*/

namespace SLCA\BuddyBoss;

add_action('plugins_loaded', function () {
if (class_exists('wpCloud\StatelessMedia\Compatibility')) {
require_once 'vendor/autoload.php';
require_once ( dirname( __FILE__ ) . '/vendor/autoload.php' );
// Load
return new BuddyBoss();
}

add_filter('plugin_row_meta', function ($plugin_meta, $plugin_file, $_, $__) {
if ($plugin_file !== join(DIRECTORY_SEPARATOR, [basename(__DIR__), basename(__FILE__)])) return $plugin_meta;
$plugin_meta[] = sprintf('<span style="color:red;">%s</span>', __('This plugin requires WP-Stateless plugin version 3.4.0 or greater to be installed and active.'));
$plugin_meta[] = sprintf('<span style="color:red;">%s</span>', __('This plugin requires WP-Stateless plugin version 3.4.0 or greater to be installed and active.', 'wp-stateless-buddyboss-platform-addon'));
return $plugin_meta;
}, 10, 4);
});
Loading