Compare commits

..
Author SHA1 Message Date
shadowdao e94ef7b84b Remove Debug Code for version 2025-04-22 13:46:42 -07:00
jknapp db1d5f8945 Merge pull request 'Major Update to add auto-update features' (#4) from auto-update into main
Create Release / build (push) Successful in 3s
Reviewed-on: #4
2025-04-22 20:38:32 +00:00
jknapp 10ec29c30a Merge branch 'main' into auto-update 2025-04-22 20:37:39 +00:00
jknapp 0d0cb65633 Add workflow to update version number on release
Create Release / build (push) Successful in 2s
2025-04-22 20:28:17 +00:00
2 changed files with 51 additions and 24 deletions
+49
View File
@@ -0,0 +1,49 @@
name: Update Plugin Version
on:
release:
types: [created, edited]
jobs:
update-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get release tag
id: get_tag
run: echo "TAG=${GITEA_REF#refs/tags/}" >> $GITEA_ENV
- name: Update version in plugin file
run: |
# Replace version in main plugin file
sed -i "s/Version: .*/Version: ${{ env.TAG }}/" fw-store-embed.php
# Verify change
grep "Version:" fw-store-embed.php
- name: Commit changes
run: |
git config --local user.email "action@gitea.com"
git config --local user.name "Gitea Action"
git add fw-store-embed.php
git commit -m "Update version to ${{ env.TAG }}"
git push
- name: Create plugin zip
run: |
mkdir -p build
zip -r build/fourthwall-store-embed.zip . -x ".git/*" ".gitea/*" "build/*" "*.git*"
- name: Upload zip to release
uses: actions/upload-release-asset@v1
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
with:
upload_url: ${{ gitea.event.release.upload_url }}
asset_path: build/fourthwall-store-embed.zip
asset_name: fourthwall-store-embed.zip
asset_content_type: application/zip
+2 -24
View File
@@ -48,11 +48,6 @@ function fwembed_check_for_updates() {
if ($response) {
$release_info = json_decode($response);
// Update debug info with latest version
$debug_data['latest_version'] = $release_info->tag_name ?? 'Not found';
$debug_data['response'] = substr(print_r($release_info, true), 0, 1000);
update_option('fwembed_update_debug', $debug_data);
// Get latest version from tag name
$latest_version = $release_info->tag_name;
@@ -96,8 +91,8 @@ function fwembed_check_for_updates() {
'package' => $download_url,
'icons' => [],
'banners' => [],
'tested' => '6.4.2',
'requires' => '5.0',
'tested' => '6.8',
'requires' => '6.2',
'compatibility' => new stdClass(),
];
@@ -108,23 +103,6 @@ function fwembed_check_for_updates() {
}
add_action('admin_init', 'fwembed_check_for_updates');
// Add admin notice for debugging
add_action('admin_notices', function() {
if (current_user_can('manage_options')) {
$debug = get_option('fwembed_update_debug', []);
echo '<div class="notice notice-info is-dismissible"><p>Update Debug: Current: ' .
esc_html($debug['current_version'] ?? 'N/A') . ', Latest: ' .
esc_html($debug['latest_version'] ?? 'N/A') . '</p>';
// Detailed debug info with query param
if (isset($_GET['fwembed_debug'])) {
echo '<pre>' . esc_html(print_r($debug, true)) . '</pre>';
}
echo '</div>';
}
});
// Add plugin information for the details popup/changelog
add_filter('plugins_api', function($result, $action, $args) {