Skip to content

Dump deployment script as multi-line block - #19

Merged
mpociot merged 2 commits into
beyondcode:masterfrom
bakerkretzmar:deployment-script-block
Jun 11, 2021
Merged

Dump deployment script as multi-line block#19
mpociot merged 2 commits into
beyondcode:masterfrom
bakerkretzmar:deployment-script-block

Conversation

@bakerkretzmar

Copy link
Copy Markdown
Contributor

Adds Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK so the deployment script is dumped as a multi-line string instead of an array of strings representing each line.

Removes the visual noise of - '' for blank lines, handles quotes a bit more nicely (doesn't need to escape them), and technically makes it so that the deploy script appears exactly as it does in Forge, including all formatting. Also, in my opinion at least, looks better.

I added a check for an array when retrieving existing configs, so this should be completely backwards-compatible.

Before:

deployment:
  - 'cd /home/forge/site.com'
  - ''
  - 'git pull origin master'
  - ''
  - 'composer install --no-interaction --no-dev --prefer-dist --optimize-autoloader'
  - ''
  - 'npm ci && npm run prod'
  - ''
  - '( flock -w 10 9 || exit 1'
  - '    echo ''Restarting FPM...''; sudo -S service php7.4-fpm reload ) 9>/tmp/fpmlock'
  - ''
  - '$FORGE_PHP artisan queue:restart'

After:

deployment: |
  cd /home/forge/site.com

  git pull origin master

  composer install --no-interaction --no-dev --prefer-dist --optimize-autoloader

  npm ci && npm run prod

  ( flock -w 10 9 || exit 1
      echo 'Restarting FPM...'; sudo -S service php7.4-fpm reload ) 9>/tmp/fpmlock

  $FORGE_PHP artisan queue:restart

@mpociot
mpociot merged commit 406135b into beyondcode:master Jun 11, 2021
@mpociot

mpociot commented Jun 11, 2021

Copy link
Copy Markdown
Member

Nice. I didn't know that flag!

@bakerkretzmar
bakerkretzmar deleted the deployment-script-block branch June 11, 2021 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants