go.ketch.com/lib/goja@v0.0.1/scripts/bumpdep.sh (about)

     1  #!/usr/bin/env sh
     2  
     3  # Code generated by shipbuilder init 1.21.2. DO NOT EDIT.
     4  
     5  if [ ! -f "./scripts/check.sh" ]; then
     6    cd $(command dirname -- "$(command readlink -f "$(command -v -- "$0")")")/..
     7  fi
     8  
     9  . ./scripts/check.sh
    10  
    11  if [ -f "./features/shipbuilder/.env" ]; then
    12    . ./features/shipbuilder/.env
    13  fi
    14  
    15  if [ -f "go.mod" ]; then
    16    check go jq
    17  fi
    18  
    19  if [ -f "package.json" ]; then
    20    check ncu npm
    21  fi
    22  
    23  if [ "$1" != "--local" ]; then
    24    check git github
    25  
    26    if [ -n "$($git status --porcelain --untracked-files=no)" ]; then
    27      echo "ERROR: you have unstaged changes"
    28      exit 1
    29    fi
    30  
    31    $git checkout main
    32    $git pull
    33  
    34    if [ -n "$($git branch --list "$USER/chore/bump-deps")" ]; then
    35      $git branch -D $USER/chore/bump-deps
    36    fi
    37    $git checkout -b $USER/chore/bump-deps
    38  fi
    39  
    40  set -e
    41  
    42  if [ -f "go.mod" ]; then
    43    export module=$($go mod edit -json | $jq -r .Module.Path)
    44  
    45    echo "module $module" > go.mod
    46    echo "" >> go.mod
    47    echo "go ${shipbuilder_go_version:-1.18}" >> go.mod
    48    echo "" >> go.mod
    49    rm go.sum
    50  
    51    $go get -u -t ./...
    52    $go mod tidy
    53    $git add go.mod go.sum
    54  fi
    55  
    56  if [ -f "package.json" ]; then
    57    $ncu -u --target latest
    58    $npm install
    59    $git add package.json package-lock.json
    60  fi
    61  
    62  if [ "$1" != "--local" ]; then
    63    ./scripts/build.sh
    64  
    65    $git commit -m "chore: bump dependencies"
    66    $git push -f
    67    $git checkout main
    68    $github pr create -H $USER/chore/bump-deps -t "chore: bump dependencies" -F ./features/shipbuilder/DEPENDENCY_PULL_REQUEST.md
    69  fi