(command.CommandList
  children: [
    (C {(Id.KW_Set set)} {(-euo)} {(pipefail)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.Subshell
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.Pipeline
                          children: [
                            (C {(grep)} {(-r)} {(KJ_DBG)} {(src/) (Id.Lit_Star '*')})
                            (C {(egrep)} {(-v)} 
                              {
                                (SQ 
                                  (Token
                                    id: Id.Lit_Chars
                                    val: '/(debug(-test)?|exception)[.]'
                                    span_id: 30
                                  )
                                )
                              }
                            )
                          ]
                          negated: F
                        )
                      ]
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:33)
            )
          ]
          action: [
            (command.Simple
              words: [
                {(echo)}
                {
                  (SQ 
                    (Token
                      id: Id.Lit_Chars
                      val: '*** Error:  There are instances of KJ_DBG in the code.'
                      span_id: 41
                    )
                  )
                }
              ]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:44)
                  fd: -1
                  arg_word: {(2)}
                )
              ]
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:48)
              arg_word: {(1)}
            )
          ]
          spids: [11 35]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(egrep)} {(-r)} {(SQ (Token id:Id.Lit_Chars val:'TODO\\(now\\)' span_id:62))} 
                  {(src/) (Id.Lit_Star '*')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:67)
            )
          ]
          action: [
            (command.Simple
              words: [
                {(echo)}
                {
                  (SQ 
                    (Token
                      id: Id.Lit_Chars
                      val: '*** Error:  There are release-blocking TODOs in the code.'
                      span_id: 75
                    )
                  )
                }
              ]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:78)
                  fd: -1
                  arg_word: {(2)}
                )
              ]
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:82)
              arg_word: {(1)}
            )
          ]
          spids: [55 69]
        )
      ]
    )
    (C {(make)} {(clean)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} 
                  {
                    (DQ (x) 
                      (command_sub
                        left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:100)
                        command_list: 
                          (command.CommandList
                            children: [(C {(git)} {(status)} {(--porcelain)})]
                          )
                      )
                    )
                  } {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(DQ (x))} {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:117)
            )
          ]
          action: [
            (command.Simple
              words: [{(echo)} {(DQ ('Please commit changes to git before releasing.'))}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:128)
                  fd: -1
                  arg_word: {(2)}
                )
              ]
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:132)
              arg_word: {(1)}
            )
          ]
          spids: [94 119]
        )
      ]
    )
    (C {(.)} {(branch.conf)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} 
                  {
                    (command_sub
                      left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:164)
                      command_list: 
                        (command.CommandList
                          children: [(C {(git)} {(rev-parse)} {(--abbrev-ref)} {(HEAD)})]
                        )
                    )
                  } {(Id.Lit_Equals '=')} {(master)} {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:179)
            )
          ]
          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: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$IS_STABLE')} {(Id.Lit_Equals '=')} 
                  {(true)} {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:198)
            )
          ]
          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: (Token id:Id.Left_DollarParen val:'$(' span_id:225)
                command_list: 
                  (command.CommandList
                    children: [
                      (C {(curl)} {(-fs)} 
                        {(https) (Id.Lit_Other ':') (//install.sandstorm.io/) 
                          ($ Id.VSub_DollarName '$CHANNEL')
                        }
                      )
                    ]
                  )
              )
            }
          spids: [224]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DParen
                  child: 
                    (arith_expr.Binary
                      op_id: Id.Arith_Great
                      left: 
                        (arith_expr.Binary
                          op_id: Id.Arith_Slash
                          left: 
                            (arith_expr.VarRef
                              token: (Token id:Id.Lit_ArithVarLike val:LAST_BUILD span_id:241)
                            )
                          right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1000)})
                        )
                      right: 
                        (arith_expr.VarRef
                          token: (Token id:Id.Lit_ArithVarLike val:BRANCH_NUMBER span_id:249)
                        )
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:253)
            )
          ]
          action: [
            (command.Simple
              words: [
                {(echo)}
                {
                  (DQ ('ERROR: ') ($ Id.VSub_DollarName '$CHANNEL') 
                    (' has already moved past this branch!')
                  )
                }
              ]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:266)
                  fd: -1
                  arg_word: {(2)}
                )
              ]
            )
            (command.Simple
              words: [{(echo)} {(DQ ('  I refuse to replace it with an older branch.'))}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:276)
                  fd: -1
                  arg_word: {(2)}
                )
              ]
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:280)
              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: 
                      (arith_expr.VarRef
                        token: (Token id:Id.Lit_ArithVarLike val:BRANCH_NUMBER span_id:290)
                      )
                    right: (arith_expr.ArithWord w:{(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: 
                          (arith_expr.VarRef
                            token: (Token id:Id.Lit_ArithVarLike val:BASE_BUILD span_id:302)
                          )
                        right: 
                          (arith_expr.VarRef
                            token: (Token id:Id.Lit_ArithVarLike val:LAST_BUILD span_id:306)
                          )
                      )
                    true_expr: 
                      (arith_expr.VarRef
                        token: (Token id:Id.Lit_ArithVarLike val:BASE_BUILD span_id:310)
                      )
                    false_expr: 
                      (arith_expr.Binary
                        op_id: Id.Arith_Plus
                        left: 
                          (arith_expr.VarRef
                            token: (Token id:Id.Lit_ArithVarLike val:LAST_BUILD span_id:314)
                          )
                        right: (arith_expr.ArithWord w:{(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: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$BUILD')})
                      right: (arith_expr.ArithWord w:{(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: (Token id:Id.Left_DollarParen val:'$(' span_id:368)
                  command_list: 
                    (command.CommandList
                      children: [(C {(date)} {(SQ (Token id:Id.Lit_Chars val:'+%Y-%m-%d' span_id:372))})]
                    )
                ) (')')
              )
            }
          spids: [363]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: 
                        {
                          (DQ 
                            (command_sub
                              left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:383)
                              command_list: 
                                (command.CommandList
                                  children: [(C {(head)} {(-n)} {(1)} {(CHANGELOG.md)})]
                                )
                            )
                          )
                        }
                      right: {(DQ ($ Id.VSub_DollarName '$EXPECTED_CHANGELOG')) (Id.Lit_Other '*')}
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:402)
            )
          ]
          action: [
            (command.Simple
              words: [{(echo)} {(DQ ('Changelog not updated. First line should be:'))}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:413)
                  fd: -1
                  arg_word: {(2)}
                )
              ]
            )
            (command.Simple
              words: [{(echo)} {(DQ ($ Id.VSub_DollarName '$EXPECTED_CHANGELOG'))}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:423)
                  fd: -1
                  arg_word: {(2)}
                )
              ]
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:427)
              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: (Token id:Id.Left_DollarParen val:'$(' span_id:486)
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.Simple
                          redirects: [
                            (redir.Redir
                              op: (Token id:Id.Redir_Less val:'<' span_id:487)
                              fd: -1
                              arg_word: {(bundle/git-revision)}
                            )
                          ]
                        )
                      ]
                    )
                )
              )
            }
          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:(Token id:Id.Lit_TildeLike val:'~' span_id:601)) 
          (/.sandstorm-update-keyring)
        }
        {($ Id.VSub_DollarName '$TARBALL')}
      ]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:606)
          fd: -1
          arg_word: {($ Id.VSub_DollarName '$TARBALL') (.update-sig)}
        )
      ]
    )
    (command.Simple
      words: [{(echo)} {($ Id.VSub_DollarName '$BUILD')}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:616)
          fd: -1
          arg_word: {(tmp/) ($ Id.VSub_DollarName '$CHANNEL')}
        )
      ]
    )
    (C {(gce-ss)} {(copy-files)} {($ Id.VSub_DollarName '$TARBALL')} 
      {(fe) (Id.Lit_Other ':') (/var/www/dl.sandstorm.io)}
    )
    (C {(gce-ss)} {(copy-files)} {($ Id.VSub_DollarName '$TARBALL') (.sig)} 
      {(fe) (Id.Lit_Other ':') (/var/www/dl.sandstorm.io)}
    )
    (C {(gce-ss)} {(copy-files)} {($ Id.VSub_DollarName '$TARBALL') (.update-sig)} 
      {(fe) (Id.Lit_Other ':') (/var/www/dl.sandstorm.io)}
    )
    (C {(gce-ss)} {(copy-files)} {(tmp/) ($ Id.VSub_DollarName '$CHANNEL')} 
      {(fe) (Id.Lit_Other ':') (/var/www/install.sandstorm.io)}
    )
    (C {(gce-ss)} {(copy-files)} {(install.sh)} {(fe) (Id.Lit_Other ':') (/var/www/install.sandstorm.io)})
    (C {(gce-ss)} {(copy-files)} {(install.sh.sig)} 
      {(fe) (Id.Lit_Other ':') (/var/www/install.sandstorm.io)}
    )
    (C {(gce-ss)} {(ssh)} {(alpha)} {(--command)} 
      {(SQ (Token id:Id.Lit_Chars val:'sudo service sandstorm update dev' span_id:694))}
    )
  ]
)