Sha256: e16638d5e8bb73e90ca6c8880dc225b6432e177f7f7114d0637a381ed4fd755b

Contents?: true

Size: 1.5 KB

Versions: 14

Compression:

Stored size: 1.5 KB

Contents

namespace :deploy do
  namespace :webpack do
    def frontend_changed?
      %x(git diff #{ReleaseTag.latest} #{fetch(:fronted_path)}).length > 0
    end

    desc <<-DESC
      Check if a new frontend release is required and deploy to S3
    DESC
    task :release do
      on roles(:all) do
        if frontend_changed? || fetch(:force_webpack_release, false)
          info '[deploy:webpack] Creating new webpack release'
          invoke 'deploy:webpack:make_new_release'
        else
          info '[deploy:webpack] Skipping webpack release as no changes were detected in frontend directory'
        end
      end
    end

    desc <<-DESC
      create new webpack bundle and release
    DESC
    task :make_new_release do
      invoke 'deploy:webpack:install_dependencies'
      invoke 'deploy:webpack:bundle'
      invoke 'deploy:webpack:add_to_version_control'
    end

    desc <<-DESC
      Installs required javascript packages from Node Package Manager
    DESC
    task :install_dependencies do
      run_locally do
        execute 'yarn install --pure-lockfile'
      end
    end

    desc <<-DESC
      Compiles webpack bundle and uploads to S3
    DESC
    task :bundle do
      run_locally do
        execute 'yarn run build'
      end
    end

    desc <<-DESC
      Check in updated webpack manifest and S3 paths to git
    DESC
    task :add_to_version_control do
      run_locally do
        execute "git commit -m '[FRONTEND] Updated webpack bundle' #{fetch(:webpack_manifest_file)}"
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
elocal_capistrano-2.3.7 lib/tasks/webpack.rake
elocal_capistrano-2.3.6 lib/tasks/webpack.rake
elocal_capistrano-2.3.5 lib/tasks/webpack.rake
elocal_capistrano-2.3.4 lib/tasks/webpack.rake
elocal_capistrano-2.3.3 lib/tasks/webpack.rake
elocal_capistrano-2.3.2 lib/tasks/webpack.rake
elocal_capistrano-2.3.1 lib/tasks/webpack.rake
elocal_capistrano-2.3.0 lib/tasks/webpack.rake
elocal_capistrano-2.2.1 lib/tasks/webpack.rake
elocal_capistrano-2.2.0 lib/tasks/webpack.rake
elocal_capistrano-2.1.3 lib/tasks/webpack.rake
elocal_capistrano-2.1.2 lib/tasks/webpack.rake
elocal_capistrano-2.1.1 lib/tasks/webpack.rake
elocal_capistrano-2.1.0 lib/tasks/webpack.rake