Skip to content

Commit

Permalink
Merge pull request #58 from threadi/feature/addGitHubActionToBuildRel…
Browse files Browse the repository at this point in the history
…ease

Feature/add GitHub action to build release
  • Loading branch information
threadi authored Dec 15, 2024
2 parents 2a3cc42 + 925f787 commit a8d8683
Show file tree
Hide file tree
Showing 30 changed files with 790 additions and 415 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build-zip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build release zip

on:
push:
tags:
- '*'

jobs:
build:
name: Build release zip
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup WP-CLI
uses: godaddy-wordpress/setup-wp-cli@1

- name: Run package installs and builds
run: |
composer install
composer update
npm i
npm i concurrently
- name: Generate autoloader
run: composer dump-autoload -oa --no-dev

- name: Run WordPress Coding Standard fixes
run: vendor/bin/phpcbf --extensions=php --ignore=*/vendor/*,*/svn/* --standard=ruleset.xml .

- name: Run WordPress Coding Standard checks
run: vendor/bin/phpcs --extensions=php --ignore=*/vendor/*,*/svn/* --standard=ruleset.xml .

- name: Generate hook documentation
run: vendor/bin/wp-documentor parse app --format=markdown --output=docs/hooks.md --prefix=eml_

- name: Set version number 1
uses: richardrigutins/replace-in-files@v2
with:
files: 'external-files-in-media-library.php'
search-text: '@@VersionNumber@@'
replacement-text: ${{ github.ref_name }}

- name: Set version number 3
uses: richardrigutins/replace-in-files@v2
with:
files: 'readme.txt'
search-text: '@@VersionNumber@@'
replacement-text: ${{ github.ref_name }}

- name: Create ZIP release
run: |
rm -fr build
rm -fr releases
rm -fr svn
rm -fr languages
rm changelog.md
rm readme.md
rm ruleset.xml
cd ..
zip -r -q ${{ github.event.repository.name }}_${{ github.ref_name }}.zip ${{ github.event.repository.name }}/* -x "*/.git/*" "*/.github/*" "*/blocks/*/src/*" "*/doc/*" "*/legacy-classes/Divi/.yarn/*" "*/phpcs.xml" "*/composer.json" "*/composer.lock" "*/package.json" "*/package-lock.json" "*/ruleset.xml" "*/.gitignore" "*/vendor/*" "*/node_modules/*" "/.editorconfig"
zip -ur ${{ github.event.repository.name }}_${{ github.ref_name }}.zip ${{ github.event.repository.name }}/vendor/autoload.php
zip -ur ${{ github.event.repository.name }}_${{ github.ref_name }}.zip ${{ github.event.repository.name }}/vendor/composer/*
zip -ur ${{ github.event.repository.name }}_${{ github.ref_name }}.zip ${{ github.event.repository.name }}/vendor/threadi/*/build/*
cp ${{ github.event.repository.name }}_${{ github.ref_name }}.zip ${{ github.event.repository.name }}/
- name: Create Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ github.event.repository.name }}_${{ github.ref_name }}.zip
29 changes: 23 additions & 6 deletions admin/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jQuery(document).ready(function($) {
});

/**
* Handling for upload of URLs from textarea in dialog.
* Handling for upload of URLs from textarea or input-field in dialog.
*/
function efml_upload_files() {
let urls = jQuery( '#external_files' ).val();
Expand Down Expand Up @@ -193,11 +193,28 @@ function efml_upload_files() {
}

// get the credentials (optional).
let login = jQuery('#eml_login').val();
let password = jQuery('#eml_password').val();
let login = '';
let password = '';
if( jQuery('#eml_use_credentials').is(':checked') ) {
login = jQuery( '#eml_login' ).val();
password = jQuery( '#eml_password' ).val();
}

// get queue setting.
let add_to_queue = jQuery('#add_to_queue').is(':checked') ? 1 : 0;
// collect values of additional fields.
let additional_fields = {};
jQuery('.easy-dialog-for-wordpress-text .eml-use-for-import').each(function() {
if( 'INPUT' === jQuery(this).prop('nodeName') ) {
if( 'checkbox' === jQuery(this).attr('type') && jQuery(this).prop('checked') === true ) {
additional_fields[jQuery(this).prop('name')] = 1;
}
if( 'text' === jQuery(this).attr('type') ) {
additional_fields[jQuery(this).prop('name')] = jQuery(this).val();
}
}
if( 'TEXTAREA' === jQuery(this).prop('nodeName') ) {
additional_fields[jQuery(this).prop('name')] = jQuery(this).val();
}
});

// send request.
jQuery.ajax({
Expand All @@ -207,7 +224,7 @@ function efml_upload_files() {
urls: urls,
login: login,
password: password,
add_to_queue: add_to_queue,
additional_fields: additional_fields,
action: 'eml_add_external_urls',
nonce: efmlJsVars.urls_nonce
},
Expand Down
4 changes: 2 additions & 2 deletions admin/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ body.settings_page_eml_settings .dashicons-yes { color: green }
margin-bottom: 0.5em;
}

.eml .easy-dialog-for-wordpress-text input[type="url"] {
.eml .easy-dialog-for-wordpress-text input[type="url"], .easy-dialog-for-wordpress-text #youtube_channel_id {
display: block;
margin-bottom: 0.5em;
width: 100%;
Expand Down Expand Up @@ -148,7 +148,7 @@ body.settings_page_eml_settings .dashicons-yes { color: green }

.wp-list-table.media #external_files { width: 120px }

.eml .easy-dialog-for-wordpress-text details {
.eml .easy-dialog-for-wordpress-text:last-of-type {
margin-bottom: 1em;
}

Expand Down
Loading

0 comments on commit a8d8683

Please sign in to comment.