Skip to content

Instantly share code, notes, and snippets.

@mattsandersuk
Last active May 16, 2023 09:50
Show Gist options
  • Select an option

  • Save mattsandersuk/9df2cc87ee47f9600f77b6717b618870 to your computer and use it in GitHub Desktop.

Select an option

Save mattsandersuk/9df2cc87ee47f9600f77b6717b618870 to your computer and use it in GitHub Desktop.

Revisions

  1. mattsandersuk revised this gist May 16, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deploy.sh
    Original file line number Diff line number Diff line change
    @@ -26,4 +26,4 @@ if [ $COMPILE = true ]; then
    fi

    # sync it
    rsync -av $TRANSFER --exclude-from '.deployignore' ./ $DEST --log-file='deploy.log' $DELETE
    rsync -av $TRANSFER --exclude-from '.deployignore' ./ $DEST --log-file='deploy.log' $DELETE --no-perms --checksum --prune-empty-dirs | sed '/\/$/d'
  2. mattsandersuk renamed this gist May 16, 2023. 1 changed file with 0 additions and 0 deletions.
  3. mattsandersuk revised this gist Jun 8, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion $ Super Simple Deployment Tool.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,8 @@ Create local versions of the following files:
    e.g.

    ```
    curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployconfig > .deployconfig && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployignore > .deployignore && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/deploy.sh > deploy.sh```
    curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployconfig > .deployconfig && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployignore > .deployignore && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/deploy.sh > deploy.sh
    ```

    Update the config variables inside `.deployconfig`.

  4. mattsandersuk revised this gist Jun 8, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion $ Super Simple Deployment Tool.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,8 @@ Create local versions of the following files:

    e.g.

    `curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployconfig > .deployconfig && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployignore > .deployignore && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/deploy.sh > deploy.sh`
    ```
    curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployconfig > .deployconfig && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployignore > .deployignore && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/deploy.sh > deploy.sh```
    Update the config variables inside `.deployconfig`.
  5. mattsandersuk revised this gist Jun 8, 2022. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion $ Super Simple Deployment Tool.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,9 @@ Create local versions of the following files:
    - `.deployignore`
    - `.deployconfig`

    `touch .deployignore deploy.sh .deployconfig`
    e.g.

    `curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployconfig > .deployconfig && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/.deployignore > .deployignore && curl https://gist.github.com/mattsandersuk/9df2cc87ee47f9600f77b6717b618870/raw/1afa5d8c4abe48b23ad1d2eb1160b1e05ea0e863/deploy.sh > deploy.sh`

    Update the config variables inside `.deployconfig`.

  6. mattsandersuk revised this gist Jun 8, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions $ Super Simple Deployment Tool.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,8 @@ Create local versions of the following files:
    - `.deployignore`
    - `.deployconfig`

    `touch .deployignore deploy.sh .deployconfig`

    Update the config variables inside `.deployconfig`.

    Add any additional files to the `.deployignore` list that you don't want to transfer.
  7. mattsandersuk revised this gist Jan 6, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion $ Super Simple Deployment Tool.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Super Simpler Deployment Tool
    # Super Simple Deployment Tool

    This tool uses `rsync` to transfer your files to a remote location.

  8. mattsandersuk renamed this gist Dec 24, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  9. mattsandersuk renamed this gist Dec 24, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. mattsandersuk revised this gist Dec 24, 2021. 2 changed files with 5 additions and 2 deletions.
    4 changes: 3 additions & 1 deletion $readme.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,9 @@ Create local versions of the following files:
    - `.deployignore`
    - `.deployconfig`

    Update the config variables inside `.deployconfig`
    Update the config variables inside `.deployconfig`.

    Add any additional files to the `.deployignore` list that you don't want to transfer.

    Run `chmod 755 deploy.sh` to allow the script to be executable.

    3 changes: 2 additions & 1 deletion .deployignore
    Original file line number Diff line number Diff line change
    @@ -12,4 +12,5 @@ deploy.sh
    webpack.mix.js
    yarn.lock
    node_modules
    vendor
    vendor
    .DS_Store
  11. mattsandersuk renamed this gist Dec 24, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  12. mattsandersuk revised this gist Dec 24, 2021. 2 changed files with 30 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions deploy.sh
    Original file line number Diff line number Diff line change
    @@ -6,10 +6,14 @@ COMPILE=false
    # -t
    TRANSFER='--dry-run'

    while getopts 'ct' FLAG; do
    # -d
    DELETE=''

    while getopts 'ctd' FLAG; do
    case "${FLAG}" in
    c) COMPILE="true" ;;
    t) TRANSFER="" ;;
    d) DELETE="--delete";;
    esac
    done

    @@ -18,8 +22,8 @@ done

    # should we COMPILE?
    if [ $COMPILE = true ]; then
    $COMPILE_COMMAND
    $COMPILE_COMMAND
    fi

    # sync it
    rsync -av $TRANSFER --exclude-from '.deployignore' ./ $DEST --log-file='deploy.log'
    rsync -av $TRANSFER --exclude-from '.deployignore' ./ $DEST --log-file='deploy.log' $DELETE
    23 changes: 23 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # Super Simpler Deployment Tool

    This tool uses `rsync` to transfer your files to a remote location.

    ## Setup

    Create local versions of the following files:

    - `deploy.sh`
    - `.deployignore`
    - `.deployconfig`

    Update the config variables inside `.deployconfig`

    Run `chmod 755 deploy.sh` to allow the script to be executable.

    ## Running

    - `./deploy.sh` - to perform a dry-run and check what files will be copied
    - `./deploy.sh -t` - to transfer the files
    - `./deploy.sh -d` - to add the `--delete` flag, this will remove any files at the destination that don't exist in the local
    - `./deploy.sh -c` - to compile assets based on the `COMPILE_COMMAND` in `.deployconfig`
    - `./deploy.sh -tdc` - to run all 3
  13. mattsandersuk revised this gist Dec 24, 2021. 2 changed files with 3 additions and 2 deletions.
    3 changes: 2 additions & 1 deletion .deployconfig
    Original file line number Diff line number Diff line change
    @@ -1 +1,2 @@
    DEST='host:path'
    DEST='host:path'
    COMPILE_COMMAND='yarn production'
    2 changes: 1 addition & 1 deletion deploy.sh
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ done

    # should we COMPILE?
    if [ $COMPILE = true ]; then
    yarn && yarn run production
    $COMPILE_COMMAND
    fi

    # sync it
  14. mattsandersuk revised this gist May 2, 2020. No changes.
  15. mattsandersuk created this gist Apr 30, 2020.
    1 change: 1 addition & 0 deletions .deployconfig
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    DEST='host:path'
    15 changes: 15 additions & 0 deletions .deployignore
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    deploy.sh
    deploy.log
    .deployignore
    .gitkeep
    .gitignore
    .git
    src
    mix-manifest.json
    package-lock.json
    package.json
    deploy.sh
    webpack.mix.js
    yarn.lock
    node_modules
    vendor
    25 changes: 25 additions & 0 deletions deploy.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    #!/bin/bash

    # -c
    COMPILE=false

    # -t
    TRANSFER='--dry-run'

    while getopts 'ct' FLAG; do
    case "${FLAG}" in
    c) COMPILE="true" ;;
    t) TRANSFER="" ;;
    esac
    done

    # load config
    . $PWD/.deployconfig

    # should we COMPILE?
    if [ $COMPILE = true ]; then
    yarn && yarn run production
    fi

    # sync it
    rsync -av $TRANSFER --exclude-from '.deployignore' ./ $DEST --log-file='deploy.log'