Skip to content

Commit

Permalink
Introduce build release process
Browse files Browse the repository at this point in the history
  • Loading branch information
lekhnathpandey committed May 18, 2020
1 parent d342ad1 commit 6c3273a
Show file tree
Hide file tree
Showing 10 changed files with 805 additions and 4,348 deletions.
16 changes: 16 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.*
.*/
*.zip
*.lock
bin/
build/
CHANGELOG.txt
composer.*
Gruntfile.js
webpack.config.js
vendor/
node_modules/
none
package-lock.json
package.json
phpcs.xml
28 changes: 28 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build release asset
on:
release:
types: [published]
jobs:
build:
name: Build release asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set env
id: vars
run: echo ::set-output name=tag::${GITHUB_REF:10}
- name: Build
id: build
uses: wpeverest/action-build@master
with:
generate-zip: true
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.build.outputs.zip_path }}
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ project.properties
*.sublime-workspace
.sublimelinterrc

# Build
build/

# Grunt
/node_modules/
none
Expand All @@ -26,3 +29,6 @@ Thumbs.db

# Composer
/vendor/

# Language files
languages/user-registration.pot
63 changes: 1 addition & 62 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,58 +153,6 @@ module.exports = function( grunt ){
}
},

// Generate POT files.
makepot: {
options: {
type: 'wp-plugin',
domainPath: 'languages',
potHeaders: {
'report-msgid-bugs-to': '[email protected]',
'language-team': 'LANGUAGE <EMAIL@ADDRESS>'
}
},
dist: {
options: {
potFilename: 'user-registration.pot',
exclude: [
'vendor/.*'
]
}
}
},

// Check textdomain errors.
checktextdomain: {
options: {
text_domain: 'user-registration',
keywords: [
'__:1,2d',
'_e:1,2d',
'_x:1,2c,3d',
'esc_html__:1,2d',
'esc_html_e:1,2d',
'esc_html_x:1,2c,3d',
'esc_attr__:1,2d',
'esc_attr_e:1,2d',
'esc_attr_x:1,2c,3d',
'_ex:1,2c,3d',
'_n:1,2,4d',
'_nx:1,2,4c,5d',
'_n_noop:1,2,3d',
'_nx_noop:1,2,3c,4d'
]
},
files: {
src: [
'**/*.php', // Include all files
'!includes/libraries/**', // Exclude libraries/
'!node_modules/**', // Exclude node_modules/
'!vendor/**' // Exclude vendor/
],
expand: true
}
},

// PHP Code Sniffer.
phpcs: {
options: {
Expand Down Expand Up @@ -273,8 +221,6 @@ module.exports = function( grunt ){
grunt.loadNpmTasks( 'grunt-rtlcss' );
grunt.loadNpmTasks( 'grunt-postcss' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-wp-i18n' );
grunt.loadNpmTasks( 'grunt-checktextdomain' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
Expand All @@ -284,9 +230,7 @@ module.exports = function( grunt ){

// Register tasks.
grunt.registerTask( 'default', [
'js',
'css',
'i18n'
'uglify'
]);

grunt.registerTask( 'js', [
Expand All @@ -308,11 +252,6 @@ module.exports = function( grunt ){
'default'
]);

grunt.registerTask( 'i18n', [
'checktextdomain',
'makepot'
]);

grunt.registerTask( 'zip', [
'dev',
'compress'
Expand Down
37 changes: 16 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,35 @@
"type": "wordpress-plugin",
"license": "GPL-3.0-or-later",
"require": {
"composer/installers": "~1.2"
"composer/installers": "1.9.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "*",
"wp-coding-standards/wpcs": "^0.14",
"wpeverest/wpeverest-git-hooks": "*",
"wpeverest/wpeverest-sniffs": "*",
"wimg/php-compatibility": "^8.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
"wp-cli/i18n-command": "2.2.2",
"wpeverest/wpeverest-sniffs": "0.0.4"
},
"scripts": {
"pre-update-cmd": [
"WPEverest\\GitHooks\\Hooks::preHooks"
],
"pre-install-cmd": [
"WPEverest\\GitHooks\\Hooks::preHooks"
],
"post-install-cmd": [
"WPEverest\\GitHooks\\Hooks::postHooks"
],
"post-update-cmd": [
"WPEverest\\GitHooks\\Hooks::postHooks"
],
"phpcs": [
"phpcs -s -p"
],
"phpcs-pre-commit": [
"phpcs -s -p -n"
],
"phpcbf": [
"phpcbf -p"
],
"makepot-audit": [
"wp --allow-root i18n make-pot . --exclude=\".github,.wordpress-org,bin,node_modules,vendor\" --slug=user-registration"
],
"makepot": [
"@makepot-audit --skip-audit"
]
},
"extra": {
"scripts-description": {
"phpcs": "Analyze code against the WordPress coding standard with PHP_CodeSniffer",
"phpcbf": "Fix coding standards warnings/errors automattically with PHP Code Beautifier"
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier",
"makepot-audit": "Generate langauges/user-registration.pot file and run audit",
"makepot": "Generate langauges/user-registration.pot file"
}
}
}
}
Loading

0 comments on commit 6c3273a

Please sign in to comment.