Skip to content

Commit

Permalink
Enable release builds in Travis CI (#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd authored Mar 19, 2020
1 parent 1461251 commit 5fed77a
Show file tree
Hide file tree
Showing 7 changed files with 724 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
/.vagrant/
/console.log
/phpcs.xml
/stream.zip
/stream-*.zip
npm-debug.log
package.lock

Expand Down
28 changes: 15 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
dist: xenial

language:
- php
- node_js
language: php

php:
- "5.6"
Expand All @@ -21,6 +19,13 @@ env:
- WP_VERSION=trunk WP_MULTISITE=0
- WP_VERSION=trunk WP_MULTISITE=1

jobs:
include:
- name: Release Package
php: "7.3"
env: WP_VERSION=latest WP_MULTISITE=0 WP_RELEASE=1
if: tag IS present

services:
- mysql

Expand All @@ -38,22 +43,19 @@ after_script:
- source $DEV_LIB_PATH/travis.after_script.sh

before_deploy:
- npm run build
- npm run release

deploy:
provider: releases
api_key:
secure: HheYiv6c8ipHzMZBTH7xcKrOwCllvJTtfiTffAPK6XubWe3Kudn6IJUv0p1gmRhWXxZ5ciJQ/sgiCRGTRm/bubHs4tS7JOmpmoTdkrXajTxyyDCKpxhtT43nie0vNF+pWqVu2yOjhDR4pwtWjpQdzEKOz0kn0XSMT+vGsKQD50w=
overwrite: true
skip_cleanup: true
file_glob: true
file: build/**/*
file:
- stream.zip
- stream-$TRAVIS_TAG.zip
on:
tags: true

# Pull requests are built by default.
branches:
only:
- master
- develop
condition: $WP_RELEASE=1

notifications:
email: false
Expand Down
25 changes: 23 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-env node */
/* eslint-env node, es6 */

module.exports = function( grunt ) {
'use strict';
Expand Down Expand Up @@ -73,6 +73,25 @@ module.exports = function( grunt ) {
},
},

compress: {
release: {
options: {
archive: function() {
if ( process.env.TRAVIS_TAG ) {
return `stream-${process.env.TRAVIS_TAG}.zip`;
}

return 'stream.zip';
},
},
cwd: 'build',
dest: 'stream',
src: [
'**/*',
],
},
},

// Clean up the build
clean: {
build: {
Expand All @@ -97,11 +116,13 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-compress' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-wp-deploy' );

// Register tasks
grunt.registerTask( 'default', [ 'uglify', 'cssmin' ] );
grunt.registerTask( 'default', [ 'clean', 'uglify', 'cssmin' ] );
grunt.registerTask( 'build', [ 'default', 'copy' ] );
grunt.registerTask( 'release', [ 'build', 'compress' ] );
grunt.registerTask( 'deploy', [ 'build', 'wp_deploy', 'clean' ] );
};
Loading

0 comments on commit 5fed77a

Please sign in to comment.