Add deploy ci

pull/18/head
sy-records 2023-07-25 08:23:02 +08:00
parent 35e3f4f549
commit 79b1e37327
No known key found for this signature in database
GPG Key ID: C3BB4FF13CD72ACE
5 changed files with 63 additions and 9 deletions

4
.distignore Normal file
View File

@ -0,0 +1,4 @@
/.git
/.github
/.distignore
/sdk/composer.lock

44
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Deploy to WordPress.org
on:
pull_request:
release:
types: [ published ]
jobs:
tag:
name: New release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.0'
tools: composer
- name: Build
run: |
composer install -o --no-dev
working-directory: sdk
- name: Set Version
if: github.event_name == 'pull_request'
run: |
echo "VERSION=ci" >> $GITHUB_ENV
- name: WordPress Plugin Deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
dry-run: ${{ github.event_name == 'pull_request' }}
generate-zip: ${{ github.event_name == 'release' }}
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: oss-aliyun
- name: Upload release asset
uses: actions/upload-release-asset@v1
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.deploy.outputs.zip-path }}
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip

View File

@ -3,7 +3,7 @@
Plugin Name: OSS Aliyun
Plugin URI: https://github.com/sy-records/aliyun-oss-wordpress
Description: 使用阿里云对象存储 OSS 作为附件存储空间。This is a plugin that uses Aliyun Object Storage Service for attachments remote saving.
Version: 1.3.2
Version: 1.4.0
Author: 沈唁
Author URI: https://qq52o.me
License: Apache 2.0
@ -17,7 +17,7 @@ require_once 'sdk/vendor/autoload.php';
use OSS\OssClient;
use OSS\Core\OssException;
define('OSS_VERSION', '1.3.2');
define('OSS_VERSION', '1.4.0');
define('OSS_BASEFOLDER', plugin_basename(dirname(__FILE__)));
if (!function_exists('get_home_path')) {

View File

@ -3,9 +3,9 @@ Contributors: shenyanzhi
Donate link: https://qq52o.me/sponsor.html
Tags: oss, 阿里云, 对象存储, aliyun
Requires at least: 4.2
Tested up to: 6.2
Requires PHP: 5.6.0
Stable tag: 1.3.2
Tested up to: 6.3
Requires PHP: 7.0.0
Stable tag: 1.4.0
License: Apache 2.0
License URI: http://www.apache.org/licenses/LICENSE-2.0.html
@ -72,6 +72,9 @@ License URI: http://www.apache.org/licenses/LICENSE-2.0.html
== Changelog ==
= 1.4.0 =
* 支持 WordPress 6.3 版本
= 1.3.2 =
* 添加地域

View File

@ -1,13 +1,16 @@
<?php
//防止有人恶意访问此文件,所以在没有 WP_UNINSTALL_PLUGIN 常量的情况下结束程序
if( !defined( 'WP_UNINSTALL_PLUGIN' ) ) exit();
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit();
}
$obs_options = get_option('oss_options', true);
$upload_url_path = get_option('upload_url_path');
$obs_upload_url_path = esc_attr($obs_options['upload_url_path']);
$oss_upload_url_path = esc_attr($obs_options['upload_url_path']);
//如果现在使用的是OSS的URL则恢复原状
if( $upload_url_path == $obs_upload_url_path ) {
if ($upload_url_path == $oss_upload_url_path) {
update_option('upload_url_path', '');
}