(command.CommandList
  children: [
    (C {<set>} {<-euo>} {<pipefail>})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.Subshell
                      child: 
                        (command.Pipeline
                          children: [
                            (C {<grep>} {<-r>} {<KJ_DBG>} {<'src/'> <Id.Lit_Star '*'>})
                            (C {<egrep>} {<-v>} {(SQ <'/(debug(-test)?|exception)[.]'>)})
                          ]
                          negated: F
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [{<echo>} {(SQ <'*** Error:  There are instances of KJ_DBG in the code.'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [11 35]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: (C {<egrep>} {<-r>} {(SQ <'TODO\\(now\\)'>)} {<'src/'> <Id.Lit_Star '*'>})
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [{<echo>} {(SQ <'*** Error:  There are release-blocking TODOs in the code.'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [55 69]
        )
      ]
    )
    (C {<make>} {<clean>})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} 
                      {
                        (DQ <x> 
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: (C {<git>} {<status>} {<--porcelain>})
                          )
                        )
                      } {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <x>)} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [{<echo>} {(DQ <'Please commit changes to git before releasing.'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [94 119]
        )
      ]
    )
    (C {<.>} {<branch.conf>})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} 
                      {
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: (C {<git>} {<rev-parse>} {<--abbrev-ref>} {<HEAD>})
                        )
                      } {<Id.Lit_Equals '='>} {<master>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:CHANNEL)
                  op: assign_op.Equal
                  rhs: {<dev>}
                  spids: [184]
                )
              ]
            )
          ]
          spids: [160 181]
        )
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$IS_STABLE')} 
                      {<Id.Lit_Equals '='>} {<true>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:CHANNEL)
                  op: assign_op.Equal
                  rhs: {<stable>}
                  spids: [203]
                )
              ]
            )
          ]
          spids: [187 200]
        )
      ]
      else_action: [
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:CHANNEL)
              op: assign_op.Equal
              rhs: {<beta>}
              spids: [209]
            )
          ]
        )
      ]
    )
    (C {<echo>} 
      {
        (DQ <'**** Determining next build number for '> ($ Id.VSub_DollarName '$CHANNEL') 
          <' channel ****'>
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LAST_BUILD)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: 
                  (C {<curl>} {<-fs>} 
                    {<https> <Id.Lit_Colon ':'> <'//install.sandstorm.io/'> 
                      ($ Id.VSub_DollarName '$CHANNEL')
                    }
                  )
              )
            }
          spids: [224]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DParen
                      child: 
                        (arith_expr.Binary
                          op_id: Id.Arith_Great
                          left: 
                            (arith_expr.Binary
                              op_id: Id.Arith_Slash
                              left: <Id.Lit_ArithVarLike LAST_BUILD>
                              right: {<Id.Lit_Digits 1000>}
                            )
                          right: <Id.Lit_ArithVarLike BRANCH_NUMBER>
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ <'ERROR: '> ($ Id.VSub_DollarName '$CHANNEL') 
                    <' has already moved past this branch!'>
                  )
                }
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [{<echo>} {(DQ <'  I refuse to replace it with an older branch.'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [237 255]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BASE_BUILD)
          op: assign_op.Equal
          rhs: 
            {
              (word_part.ArithSub
                anode: 
                  (arith_expr.Binary
                    op_id: Id.Arith_Star
                    left: <Id.Lit_ArithVarLike BRANCH_NUMBER>
                    right: {<Id.Lit_Digits 1000>}
                  )
              )
            }
          spids: [287]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BUILD)
          op: assign_op.Equal
          rhs: 
            {
              (word_part.ArithSub
                anode: 
                  (arith_expr.TernaryOp
                    cond: 
                      (arith_expr.Binary
                        op_id: Id.Arith_Great
                        left: <Id.Lit_ArithVarLike BASE_BUILD>
                        right: <Id.Lit_ArithVarLike LAST_BUILD>
                      )
                    true_expr: <Id.Lit_ArithVarLike BASE_BUILD>
                    false_expr: 
                      (arith_expr.Binary
                        op_id: Id.Arith_Plus
                        left: <Id.Lit_ArithVarLike LAST_BUILD>
                        right: {<Id.Lit_Digits 1>}
                      )
                  )
              )
            }
          spids: [299]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BUILD_MINOR)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (word_part.ArithSub
                  anode: 
                    (arith_expr.Binary
                      op_id: Id.Arith_Percent
                      left: {($ Id.VSub_DollarName '$BUILD')}
                      right: {<Id.Lit_Digits 1000>}
                    )
                )
              )
            }
          spids: [323]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DISPLAY_VERSION)
          op: assign_op.Equal
          rhs: {(DQ (${ Id.VSub_Name BRANCH_NUMBER) <.> (${ Id.VSub_Name BUILD_MINOR))}
          spids: [337]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TAG_NAME)
          op: assign_op.Equal
          rhs: {(DQ <v> (${ Id.VSub_Name DISPLAY_VERSION))}
          spids: [348]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SIGNING_KEY_ID)
          op: assign_op.Equal
          rhs: {<160D2D577518B58D94C9800B63F227499DA8CCBD>}
          spids: [356]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:EXPECTED_CHANGELOG)
          op: assign_op.Equal
          rhs: 
            {
              (DQ <'### '> ($ Id.VSub_DollarName '$TAG_NAME') <' ('> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<date>} {(SQ <'+%Y-%m-%d'>)})
                ) <')'>
              )
            }
          spids: [363]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobNEqual
                          left: 
                            {
                              (DQ 
                                (command_sub
                                  left_token: <Id.Left_DollarParen '$('>
                                  child: (C {<head>} {<-n>} {<1>} {<CHANGELOG.md>})
                                )
                              )
                            }
                          right: 
                            {(DQ ($ Id.VSub_DollarName '$EXPECTED_CHANGELOG')) <Id.Lit_Other '*'>}
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [{<echo>} {(DQ <'Changelog not updated. First line should be:'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$EXPECTED_CHANGELOG'))}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [378 404]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TARBALL)
          op: assign_op.Equal
          rhs: {<sandstorm-> ($ Id.VSub_DollarName '$BUILD') <.tar.xz>}
          spids: [446]
        )
      ]
    )
    (C {<echo>} {(DQ <'**** Building build '> ($ Id.VSub_DollarName '$BUILD') <' ****'>)})
    (C {<make>} {<Id.Lit_VarLike 'BUILD='> ($ Id.VSub_DollarName '$BUILD')})
    (C {<echo>} {(DQ <'**** Tagging this commit ****'>)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_REVISION)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Simple
                      redirects: [
                        (redir
                          op: <Id.Redir_Less '<'>
                          loc: (redir_loc.Fd fd:0)
                          arg: {<'bundle/git-revision'>}
                        )
                      ]
                      do_fork: F
                    )
                )
              )
            }
          spids: [484]
        )
      ]
    )
    (C {<git>} {<tag>} {<-u>} {($ Id.VSub_DollarName '$SIGNING_KEY_ID')} 
      {(DQ ($ Id.VSub_DollarName '$TAG_NAME'))} {(DQ ($ Id.VSub_DollarName '$GIT_REVISION'))} {<-m>} 
      {(DQ <'Release Sandstorm '> (${ Id.VSub_Name DISPLAY_VERSION))}
    )
    (C {<git>} {<push>} {<origin>} {(DQ ($ Id.VSub_DollarName '$TAG_NAME'))})
    (C {<echo>} {(DQ <'**** Pushing build '> ($ Id.VSub_DollarName '$BUILD') <' ****'>)})
    (C {<rm>} {<-f>} {($ Id.VSub_DollarName '$TARBALL') <.sig>} 
      {($ Id.VSub_DollarName '$TARBALL') <.update-sig>} {<install.sh.sig>}
    )
    (C {<gpg>} {<-u>} {($ Id.VSub_DollarName '$SIGNING_KEY_ID')} {<--digest-algo>} {<SHA512>} 
      {<--detach-sig>} {($ Id.VSub_DollarName '$TARBALL')}
    )
    (C {<gpg>} {<-u>} {($ Id.VSub_DollarName '$SIGNING_KEY_ID')} {<--digest-algo>} {<SHA512>} 
      {<--detach-sig>} {<install.sh>}
    )
    (command.Simple
      words: [
        {<'tmp/sandstorm/update-tool'>}
        {<sign>}
        {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <'/.sandstorm-update-keyring'>}
        {($ Id.VSub_DollarName '$TARBALL')}
      ]
      redirects: [
        (redir
          op: <Id.Redir_Great '>'>
          loc: (redir_loc.Fd fd:1)
          arg: {($ Id.VSub_DollarName '$TARBALL') <.update-sig>}
        )
      ]
      do_fork: T
    )
    (command.Simple
      words: [{<echo>} {($ Id.VSub_DollarName '$BUILD')}]
      redirects: [
        (redir
          op: <Id.Redir_Great '>'>
          loc: (redir_loc.Fd fd:1)
          arg: {<'tmp/'> ($ Id.VSub_DollarName '$CHANNEL')}
        )
      ]
      do_fork: T
    )
    (C {<gce-ss>} {<copy-files>} {($ Id.VSub_DollarName '$TARBALL')} 
      {<fe> <Id.Lit_Colon ':'> <'/var/www/dl.sandstorm.io'>}
    )
    (C {<gce-ss>} {<copy-files>} {($ Id.VSub_DollarName '$TARBALL') <.sig>} 
      {<fe> <Id.Lit_Colon ':'> <'/var/www/dl.sandstorm.io'>}
    )
    (C {<gce-ss>} {<copy-files>} {($ Id.VSub_DollarName '$TARBALL') <.update-sig>} 
      {<fe> <Id.Lit_Colon ':'> <'/var/www/dl.sandstorm.io'>}
    )
    (C {<gce-ss>} {<copy-files>} {<'tmp/'> ($ Id.VSub_DollarName '$CHANNEL')} 
      {<fe> <Id.Lit_Colon ':'> <'/var/www/install.sandstorm.io'>}
    )
    (C {<gce-ss>} {<copy-files>} {<install.sh>} 
      {<fe> <Id.Lit_Colon ':'> <'/var/www/install.sandstorm.io'>}
    )
    (C {<gce-ss>} {<copy-files>} {<install.sh.sig>} 
      {<fe> <Id.Lit_Colon ':'> <'/var/www/install.sandstorm.io'>}
    )
    (C {<gce-ss>} {<ssh>} {<alpha>} {<--command>} {(SQ <'sudo service sandstorm update dev'>)})
  ]
)