production.yml 3.9 KB

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