production.yml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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)\n<${{ github.event.pull_request.html_url || github.event.head_commit.url }}|Link to commit>",
  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: Build Image
  75. timeout-minutes: 20
  76. uses: porter-dev/porter-cli-action@v0.1.0
  77. with:
  78. command: update build --app porter-ui --tag ${{ steps.vars.outputs.sha_short }} --stream
  79. env:
  80. PORTER_HOST: https://dashboard.internal-tools.porter.run
  81. PORTER_CLUSTER: 9
  82. PORTER_PROJECT: 5
  83. PORTER_TOKEN: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  84. - name: Push Image
  85. timeout-minutes: 20
  86. uses: porter-dev/porter-cli-action@v0.1.0
  87. with:
  88. command: update push --app porter-ui --tag ${{ steps.vars.outputs.sha_short }} --stream
  89. env:
  90. PORTER_HOST: https://dashboard.internal-tools.porter.run
  91. PORTER_CLUSTER: 9
  92. PORTER_PROJECT: 5
  93. PORTER_TOKEN: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  94. - name: Update Porter Migration Job
  95. timeout-minutes: 20
  96. uses: porter-dev/porter-cli-action@v0.1.0
  97. with:
  98. command: update config --app migrate --tag ${{ steps.vars.outputs.sha_short }} --stream
  99. env:
  100. PORTER_HOST: https://dashboard.internal-tools.porter.run
  101. PORTER_CLUSTER: 9
  102. PORTER_PROJECT: 5
  103. PORTER_TOKEN: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  104. - name: Run Migration Job
  105. timeout-minutes: 20
  106. uses: porter-dev/porter-run-job-action@v0.1.0
  107. with:
  108. job: migrate
  109. host: https://dashboard.internal-tools.porter.run
  110. cluster: 9
  111. project: 5
  112. token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  113. - name: Update Porter Server
  114. timeout-minutes: 20
  115. uses: porter-dev/porter-update-config-action@v0.1.0
  116. with:
  117. app: porter-ui
  118. cluster: "9"
  119. host: https://dashboard.internal-tools.porter.run
  120. namespace: default
  121. project: "5"
  122. tag: ${{ steps.vars.outputs.sha_short }}
  123. token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  124. - name: Update Porter Auth
  125. timeout-minutes: 20
  126. uses: porter-dev/porter-update-config-action@v0.1.0
  127. with:
  128. app: porter-auth
  129. cluster: "9"
  130. host: https://dashboard.internal-tools.porter.run
  131. namespace: default
  132. project: "5"
  133. tag: ${{ steps.vars.outputs.sha_short }}
  134. token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  135. deploy-worker-pool:
  136. runs-on: ubuntu-latest
  137. needs: [build-go, build-npm] # don't run this step unless these finish successfully
  138. steps:
  139. - name: Checkout code
  140. uses: actions/checkout@v3
  141. - name: Set Github tag
  142. id: vars
  143. run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
  144. - name: Update Worker Pool (revision cull job)
  145. timeout-minutes: 20
  146. uses: porter-dev/porter-update-action@v0.1.0
  147. with:
  148. app: cull-helm-revisions
  149. cluster: "9"
  150. host: https://dashboard.internal-tools.porter.run
  151. namespace: default
  152. project: "5"
  153. tag: ${{ steps.vars.outputs.sha_short }}
  154. token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  155. deploy-end:
  156. name: Mark deploy as ended
  157. runs-on: ubuntu-latest
  158. if: always()
  159. needs:
  160. - deploy-start
  161. - deploy-porter
  162. - deploy-worker-pool
  163. steps:
  164. - name: Slack Notification
  165. uses: slackapi/slack-github-action@v1
  166. continue-on-error: true
  167. env:
  168. SLACK_WEBHOOK_URL: ${{ secrets.PORTER_PROD_NOTIFICATIONS_SLACK_WEBHOOK }}
  169. with:
  170. update-ts: ${{ steps.deploy-start.outputs.deploy-ts }}
  171. payload: |
  172. {
  173. "text": "porter prod deploy completed\n<${{ github.event.pull_request.html_url || github.event.head_commit.url }}|Link to commit>",
  174. "attachments": [
  175. {
  176. "pretext": "Deployment completed",
  177. "color": "8590ff",
  178. "fields": [
  179. {
  180. "title": "Porter Result",
  181. "short": true,
  182. "value": "${{ needs.deploy-porter.result }}"
  183. },
  184. {
  185. "title": "Worker Pool Result",
  186. "short": true,
  187. "value": "${{ needs.deploy-worker-pool.result }}"
  188. }
  189. ]
  190. }
  191. ]
  192. }