Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
emodric committed Feb 23, 2021
2 parents e4a76bb + bae0596 commit 5b40a49
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 7 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@
/var/encore/*
!var/encore/.gitkeep

/public/assets/app/*
!/public/assets/app/build/
/public/assets/build/*
/public/assets/ezplatform/*
!/public/assets/ezplatform/build/
/public/assets/

/web
/public/var
Expand Down
2 changes: 2 additions & 0 deletions deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
require __DIR__ . '/deploy/tasks/sentry.php';
require __DIR__ . '/deploy/tasks/logs.php';
require __DIR__ . '/deploy/tasks/overrides.php';
require __DIR__ . '/deploy/tasks/assets.php';
require __DIR__ . '/deploy/tasks/app.php';
require __DIR__ . '/deploy/parameters.php';
// optional: slack integration
//require __DIR__ . '/deploy/tasks/slack.php';
Expand Down
5 changes: 5 additions & 0 deletions deploy/tasks/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

namespace Deployer;

// put your application specific tasks here
56 changes: 56 additions & 0 deletions deploy/tasks/assets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace Deployer;

// parameters
set('asset_resource_paths', [
'src/AppBundle/Resources/es6',
'src/AppBundle/Resources/sass'
]);
set('asset_build_paths', [
'assets',
]);
set('asset_exclude_paths', [
'assets/app/build_dev'
]);
set('asset_install_command', 'yarn install');
set('asset_build_command', 'yarn build:prod');
set('asset_ezplatform_build_command', 'composer ezplatform-assets');

task('assets:deploy', [
'assets:build',
'assets:ezplatform:build',
'assets:upload'
]);

task('assets:build', function() {
writeln('<comment>Checking for changes in asset files. If this fails, commit or stash your changes before deploying.</comment>');
$assetResourcePaths = get('asset_resource_paths');
foreach ($assetResourcePaths as $resourcePath) {
run("git diff --exit-code {$resourcePath}");
}

$installCmd = get('asset_install_command');
run($installCmd);

$buildCmd = get('asset_build_command');
run($buildCmd);
})->local();

task('assets:ezplatform:build', function() {
run("{{asset_ezplatform_build_command}}");
})->local();

task('assets:upload', function() {
$assetPaths = get('asset_build_paths');
$excludedPaths = get('asset_exclude_paths', []);

$config = [];
foreach ($excludedPaths as $excludedPath) {
$config['options'][] = "--exclude {$excludedPath}";
}

foreach ($assetPaths as $path) {
upload("public/{$path}", '{{release_path}}/public', $config);
}
});
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
]
},
"scripts": {
"dev": "encore dev",
"build:dev": "encore dev",
"prod": "encore production",
"build:prod": "encore production",
"watch": "encore dev --watch",
"start": "encore dev-server",
Expand Down

0 comments on commit 5b40a49

Please sign in to comment.