production.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. "on":
  2. push:
  3. tags:
  4. - production
  5. name: Deploy Porter to Production
  6. jobs:
  7. deploy-start:
  8. name: Mark deploy as started
  9. runs-on: ubuntu-latest
  10. outputs:
  11. deploy-ts: ${{ steps.deploy.outputs.ts }}
  12. steps:
  13. - name: Slack Notification
  14. uses: slackapi/slack-github-action@v1
  15. id: deploy
  16. continue-on-error: true
  17. env:
  18. SLACK_WEBHOOK_URL: ${{ secrets.PORTER_PROD_NOTIFICATIONS_SLACK_WEBHOOK }}
  19. with:
  20. payload: |
  21. {
  22. "text": "porter prod deploy started (In Progress)",
  23. "attachments": [
  24. {
  25. "pretext": "Deployment started",
  26. "color": "dbab09",
  27. "fields": [
  28. {
  29. "title": "Status",
  30. "short": true,
  31. "value": "In Progress"
  32. }
  33. ]
  34. }
  35. ]
  36. }
  37. build-go:
  38. runs-on: ubuntu-latest
  39. needs:
  40. - deploy-start
  41. steps:
  42. - name: Checkout code
  43. uses: actions/checkout@v3
  44. - name: build-go
  45. uses: ./.github/actions/build-go
  46. build-npm:
  47. runs-on: ubuntu-latest
  48. needs:
  49. - deploy-start
  50. steps:
  51. - name: Checkout code
  52. uses: actions/checkout@v3
  53. - name: build-npm
  54. uses: ./.github/actions/build-npm
  55. deploy-porter:
  56. runs-on: ubuntu-latest
  57. needs: [build-go, build-npm]
  58. steps:
  59. - name: Checkout code
  60. uses: actions/checkout@v3
  61. - name: Get Go Binaries
  62. uses: actions/download-artifact@v3
  63. with:
  64. name: go-binaries
  65. path: bin/
  66. - name: Get NPM static files
  67. uses: actions/download-artifact@v3
  68. with:
  69. name: npm-static-files
  70. path: build/
  71. - name: Set Github tag
  72. id: vars
  73. run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
  74. - name: Update Porter API
  75. timeout-minutes: 20
  76. uses: porter-dev/porter-update-action@v0.1.0
  77. with:
  78. app: porter-ui
  79. cluster: "9"
  80. host: https://dashboard.internal-tools.porter.run
  81. namespace: default
  82. project: "5"
  83. tag: ${{ steps.vars.outputs.sha_short }}
  84. token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  85. - name: Update Porter Auth
  86. timeout-minutes: 20
  87. uses: porter-dev/porter-update-config-action@v0.1.0
  88. with:
  89. app: porter-auth
  90. cluster: "9"
  91. host: https://dashboard.internal-tools.porter.run
  92. namespace: default
  93. project: "5"
  94. tag: ${{ steps.vars.outputs.sha_short }}
  95. token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  96. deploy-worker-pool:
  97. runs-on: ubuntu-latest
  98. needs: [build-go, build-npm] # don't run this step unless these finish successfully
  99. steps:
  100. - name: Checkout code
  101. uses: actions/checkout@v3
  102. - name: Set Github tag
  103. id: vars
  104. run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
  105. - name: Update Worker Pool (revision cull job)
  106. timeout-minutes: 20
  107. uses: porter-dev/porter-update-action@v0.1.0
  108. with:
  109. app: cull-helm-revisions
  110. cluster: "9"
  111. host: https://dashboard.internal-tools.porter.run
  112. namespace: default
  113. project: "5"
  114. tag: ${{ steps.vars.outputs.sha_short }}
  115. token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  116. deploy-end:
  117. name: Mark deploy as ended
  118. runs-on: ubuntu-latest
  119. if: always()
  120. needs:
  121. - deploy-start
  122. - deploy-porter
  123. - deploy-worker-pool
  124. steps:
  125. - name: Slack Notification
  126. uses: slackapi/slack-github-action@v1
  127. continue-on-error: true
  128. env:
  129. SLACK_WEBHOOK_URL: ${{ secrets.PORTER_PROD_NOTIFICATIONS_SLACK_WEBHOOK }}
  130. with:
  131. update-ts: ${{ steps.deploy-start.outputs.deploy-ts }}
  132. payload: |
  133. {
  134. "text": "porter prod deploy completed",
  135. "attachments": [
  136. {
  137. "pretext": "Deployment completed",
  138. "color": "8590ff",
  139. "fields": [
  140. {
  141. "title": "Porter Result",
  142. "short": true,
  143. "value": "${{ needs.deploy-porter.result }}"
  144. },
  145. {
  146. "title": "Worker Pool Result",
  147. "short": true,
  148. "value": "${{ needs.deploy-worker-pool.result }}"
  149. }
  150. ]
  151. }
  152. ]
  153. }