production.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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: porter-deploy
  62. timeout-minutes: 30
  63. uses: ./.github/actions/porter-deploy
  64. with:
  65. app: porter
  66. cluster: "9"
  67. host: https://dashboard.internal-tools.porter.run
  68. project: "5"
  69. token: ${{ secrets.PORTER_STACK_5_9 }}
  70. deploy-worker-pool:
  71. runs-on: ubuntu-latest
  72. needs: [build-go, build-npm] # don't run this step unless these finish successfully
  73. steps:
  74. - name: Checkout code
  75. uses: actions/checkout@v3
  76. - name: Set Github tag
  77. id: vars
  78. run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
  79. - name: Update Worker Pool (revision cull job)
  80. timeout-minutes: 20
  81. uses: porter-dev/porter-update-action@v0.1.0
  82. with:
  83. app: cull-helm-revisions
  84. cluster: "9"
  85. host: https://dashboard.internal-tools.porter.run
  86. namespace: default
  87. project: "5"
  88. tag: ${{ steps.vars.outputs.sha_short }}
  89. token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
  90. deploy-end:
  91. name: Mark deploy as ended
  92. runs-on: ubuntu-latest
  93. if: always()
  94. needs:
  95. - deploy-start
  96. - deploy-porter
  97. - deploy-worker-pool
  98. steps:
  99. - name: Slack Notification
  100. uses: slackapi/slack-github-action@v1
  101. continue-on-error: true
  102. env:
  103. SLACK_WEBHOOK_URL: ${{ secrets.PORTER_PROD_NOTIFICATIONS_SLACK_WEBHOOK }}
  104. with:
  105. update-ts: ${{ steps.deploy-start.outputs.deploy-ts }}
  106. payload: |
  107. {
  108. "text": "porter prod deploy completed\n<${{ github.event.pull_request.html_url || github.event.head_commit.url }}|Link to commit>",
  109. "attachments": [
  110. {
  111. "pretext": "Deployment completed",
  112. "color": "8590ff",
  113. "fields": [
  114. {
  115. "title": "Porter Result",
  116. "short": true,
  117. "value": "${{ needs.deploy-porter.result }}"
  118. },
  119. {
  120. "title": "Worker Pool Result",
  121. "short": true,
  122. "value": "${{ needs.deploy-worker-pool.result }}"
  123. }
  124. ]
  125. }
  126. ]
  127. }