(CommandList
  children: [
    (C {(set)} {(-euo)} {(pipefail)})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (Subshell
                  child: 
                    (Pipeline
                      children: [
                        (C {(grep)} {(-r)} {(KJ_DBG)} {(src/) (Lit_Other "*")})
                        (C {(egrep)} {(-v)} {(SQ <"/(debug(-test)?|exception)[.]">)})
                      ]
                      negated: False
                    )
                  spids: [13 32]
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [{(echo)} {(SQ <"*** Error:  There are instances of KJ_DBG in the code.">)}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[44])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 35]
        )
      ]
      spids: [-1 52]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(egrep)} {(-r)} {(SQ <"TODO\\(now\\)">)} {(src/) (Lit_Other "*")})
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [{(echo)} {(SQ <"*** Error:  There are release-blocking TODOs in the code.">)}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[78])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 69]
        )
      ]
      spids: [-1 86]
    )
    (C {(make)} {(clean)})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} 
                  {
                    (DQ (x) 
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(git)} {(status)} {(--porcelain)})])
                        left_token: <Left_CommandSub "$(">
                        spids: [100 106]
                      )
                    )
                  } {(KW_Bang "!") (Lit_Other "=")} {(DQ (x))} {(Lit_Other "]")}
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [{(echo)} {(DQ ("Please commit changes to git before releasing."))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[128])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 119]
        )
      ]
      spids: [-1 136]
    )
    (C {(.)} {(branch.conf)})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} 
                  {
                    (CommandSubPart
                      command_list: 
                        (CommandList
                          children: [(C {(git)} {(rev-parse)} {(--abbrev-ref)} {(HEAD)})]
                        )
                      left_token: <Left_CommandSub "$(">
                      spids: [164 172]
                    )
                  } {(Lit_Other "=")} {(master)} {(Lit_Other "]")}
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:CHANNEL) op:Equal rhs:{(dev)} spids:[184])]
              spids: [184]
            )
          ]
          spids: [-1 181]
        )
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} {($ VSub_Name "$IS_STABLE")} {(Lit_Other "=")} {(true)} 
                  {(Lit_Other "]")}
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:CHANNEL) op:Equal rhs:{(stable)} spids:[203])]
              spids: [203]
            )
          ]
          spids: [187 200]
        )
      ]
      else_action: [
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:CHANNEL) op:Equal rhs:{(beta)} spids:[209])]
          spids: [209]
        )
      ]
      spids: [206 212]
    )
    (C {(echo)} 
      {(DQ ("**** Determining next build number for ") ($ VSub_Name "$CHANNEL") (" channel ****"))}
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:LAST_BUILD)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (C {(curl)} {(-fs)} 
                        {(https) (Lit_Other ":") (//install.sandstorm.io/) ($ VSub_Name "$CHANNEL")}
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [225 234]
              )
            }
          spids: [224]
        )
      ]
      spids: [224]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DParen
                  child: 
                    (ArithBinary
                      op_id: Arith_Great
                      left: 
                        (ArithBinary
                          op_id: Arith_Slash
                          left: (ArithVarRef name:LAST_BUILD)
                          right: (ArithWord w:{(Lit_Digits 1000)})
                        )
                      right: (ArithVarRef name:BRANCH_NUMBER)
                    )
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ("ERROR: ") ($ VSub_Name "$CHANNEL") (" has already moved past this branch!"))}
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[266])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("  I refuse to replace it with an older branch."))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[276])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 255]
        )
      ]
      spids: [-1 284]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:BASE_BUILD)
          op: Equal
          rhs: 
            {
              (ArithSubPart
                anode: 
                  (ArithBinary
                    op_id: Arith_Star
                    left: (ArithVarRef name:BRANCH_NUMBER)
                    right: (ArithWord w:{(Lit_Digits 1000)})
                  )
                spids: [288 297]
              )
            }
          spids: [287]
        )
      ]
      spids: [287]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:BUILD)
          op: Equal
          rhs: 
            {
              (ArithSubPart
                anode: 
                  (TernaryOp
                    cond: 
                      (ArithBinary
                        op_id: Arith_Great
                        left: (ArithVarRef name:BASE_BUILD)
                        right: (ArithVarRef name:LAST_BUILD)
                      )
                    true_expr: (ArithVarRef name:BASE_BUILD)
                    false_expr: 
                      (ArithBinary
                        op_id: Arith_Plus
                        left: (ArithVarRef name:LAST_BUILD)
                        right: (ArithWord w:{(Lit_Digits 1)})
                      )
                  )
                spids: [300 321]
              )
            }
          spids: [299]
        )
      ]
      spids: [299]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:BUILD_MINOR)
          op: Equal
          rhs: 
            {
              (DQ 
                (ArithSubPart
                  anode: 
                    (ArithBinary
                      op_id: Arith_Percent
                      left: (ArithWord w:{($ VSub_Name "$BUILD")})
                      right: (ArithWord w:{(Lit_Digits 1000)})
                    )
                  spids: [325 334]
                )
              )
            }
          spids: [323]
        )
      ]
      spids: [323]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:DISPLAY_VERSION)
          op: Equal
          rhs: {(DQ (${ VSub_Name BRANCH_NUMBER) (.) (${ VSub_Name BUILD_MINOR))}
          spids: [337]
        )
      ]
      spids: [337]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:TAG_NAME)
          op: Equal
          rhs: {(DQ (v) (${ VSub_Name DISPLAY_VERSION))}
          spids: [348]
        )
      ]
      spids: [348]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:SIGNING_KEY_ID)
          op: Equal
          rhs: {(160D2D577518B58D94C9800B63F227499DA8CCBD)}
          spids: [356]
        )
      ]
      spids: [356]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:EXPECTED_CHANGELOG)
          op: Equal
          rhs: 
            {
              (DQ ("### ") ($ VSub_Name "$TAG_NAME") (" (") 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(date)} {(SQ <"+%Y-%m-%d">)})])
                  left_token: <Left_CommandSub "$(">
                  spids: [368 374]
                ) (")")
              )
            }
          spids: [363]
        )
      ]
      spids: [363]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobNEqual
                      left: 
                        {
                          (DQ 
                            (CommandSubPart
                              command_list: 
                                (CommandList
                                  children: [(C {(head)} {(-n)} {(1)} {(CHANGELOG.md)})]
                                )
                              left_token: <Left_CommandSub "$(">
                              spids: [383 391]
                            )
                          )
                        }
                      right: {(DQ ($ VSub_Name "$EXPECTED_CHANGELOG")) (Lit_Other "*")}
                    )
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [{(echo)} {(DQ ("Changelog not updated. First line should be:"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[413])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_Name "$EXPECTED_CHANGELOG"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[423])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 404]
        )
      ]
      spids: [-1 431]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:TARBALL)
          op: Equal
          rhs: {(sandstorm-) ($ VSub_Name "$BUILD") (.tar.xz)}
          spids: [446]
        )
      ]
      spids: [446]
    )
    (C {(echo)} {(DQ ("**** Building build ") ($ VSub_Name "$BUILD") (" ****"))})
    (C {(make)} {(Lit_VarLike "BUILD=") ($ VSub_Name "$BUILD")})
    (C {(echo)} {(DQ ("**** Tagging this commit ****"))})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:GIT_REVISION)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (SimpleCommand
                          redirects: [
                            (Redir
                              op_id: Redir_Less
                              fd: -1
                              arg_word: {(bundle/git-revision)}
                              spids: [487]
                            )
                          ]
                        )
                      ]
                    )
                  left_token: <Left_CommandSub "$(">
                  spids: [486 489]
                )
              )
            }
          spids: [484]
        )
      ]
      spids: [484]
    )
    (C {(git)} {(tag)} {(-u)} {($ VSub_Name "$SIGNING_KEY_ID")} {(DQ ($ VSub_Name "$TAG_NAME"))} 
      {(DQ ($ VSub_Name "$GIT_REVISION"))} {(-m)} {(DQ ("Release Sandstorm ") (${ VSub_Name DISPLAY_VERSION))}
    )
    (C {(git)} {(push)} {(origin)} {(DQ ($ VSub_Name "$TAG_NAME"))})
    (C {(echo)} {(DQ ("**** Pushing build ") ($ VSub_Name "$BUILD") (" ****"))})
    (C {(rm)} {(-f)} {($ VSub_Name "$TARBALL") (.sig)} {($ VSub_Name "$TARBALL") (.update-sig)} 
      {(install.sh.sig)}
    )
    (C {(gpg)} {(-u)} {($ VSub_Name "$SIGNING_KEY_ID")} {(--digest-algo)} {(SHA512)} {(--detach-sig)} 
      {($ VSub_Name "$TARBALL")}
    )
    (C {(gpg)} {(-u)} {($ VSub_Name "$SIGNING_KEY_ID")} {(--digest-algo)} {(SHA512)} {(--detach-sig)} 
      {(install.sh)}
    )
    (SimpleCommand
      words: [
        {(tmp/sandstorm/update-tool)}
        {(sign)}
        {(TildeSubPart prefix:"") (/.sandstorm-update-keyring)}
        {($ VSub_Name "$TARBALL")}
      ]
      redirects: [
        (Redir
          op_id: Redir_Great
          fd: -1
          arg_word: {($ VSub_Name "$TARBALL") (.update-sig)}
          spids: [606]
        )
      ]
    )
    (SimpleCommand
      words: [{(echo)} {($ VSub_Name "$BUILD")}]
      redirects: [
        (Redir
          op_id: Redir_Great
          fd: -1
          arg_word: {(tmp/) ($ VSub_Name "$CHANNEL")}
          spids: [616]
        )
      ]
    )
    (C {(gce-ss)} {(copy-files)} {($ VSub_Name "$TARBALL")} 
      {(fe) (Lit_Other ":") (/var/www/dl.sandstorm.io)}
    )
    (C {(gce-ss)} {(copy-files)} {($ VSub_Name "$TARBALL") (.sig)} 
      {(fe) (Lit_Other ":") (/var/www/dl.sandstorm.io)}
    )
    (C {(gce-ss)} {(copy-files)} {($ VSub_Name "$TARBALL") (.update-sig)} 
      {(fe) (Lit_Other ":") (/var/www/dl.sandstorm.io)}
    )
    (C {(gce-ss)} {(copy-files)} {(tmp/) ($ VSub_Name "$CHANNEL")} 
      {(fe) (Lit_Other ":") (/var/www/install.sandstorm.io)}
    )
    (C {(gce-ss)} {(copy-files)} {(install.sh)} {(fe) (Lit_Other ":") (/var/www/install.sandstorm.io)})
    (C {(gce-ss)} {(copy-files)} {(install.sh.sig)} 
      {(fe) (Lit_Other ":") (/var/www/install.sandstorm.io)}
    )
    (C {(gce-ss)} {(ssh)} {(alpha)} {(--command)} {(SQ <"sudo service sandstorm update dev">)})
  ]
)