internal_tooling_stack_porter-ui.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. "on":
  2. push:
  3. branches:
  4. - master
  5. name: Deploy Porter to Internal Tooling
  6. jobs:
  7. build-go:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout code
  11. uses: actions/checkout@v3
  12. - name: Setup Go Cache
  13. uses: actions/cache@v3
  14. with:
  15. path: |
  16. ~/.cache/go-build
  17. ~/go/pkg/mod
  18. key: porter-go-${{ hashFiles('**/go.sum') }}
  19. restore-keys: porter-go-`
  20. - name: Setup Go
  21. uses: actions/setup-go@v4
  22. with:
  23. go-version-file: go.mod
  24. cache: false
  25. - name: Download Go Modules
  26. run: go mod download
  27. - name: Build Server Binary
  28. run: go build -ldflags="-w -s -X 'main.Version=production'" -o ./bin/app ./cmd/app
  29. - name: Build Migration Binary
  30. run: go build -ldflags '-w -s' -o ./bin/migrate ./cmd/migrate
  31. - name: Store Binaries
  32. uses: actions/upload-artifact@v3
  33. with:
  34. name: go-binaries
  35. path: bin/
  36. build-npm:
  37. runs-on: ubuntu-latest
  38. steps:
  39. - name: Checkout code
  40. uses: actions/checkout@v3
  41. - name: Setup Node
  42. uses: actions/setup-node@v3
  43. with:
  44. node-version: 16
  45. - name: Install NPM Dependencies
  46. run: |
  47. cd dashboard
  48. npm i --legacy-peer-deps
  49. - name: Run NPM Build
  50. run: |
  51. cd dashboard
  52. npm run build
  53. - name: Store NPM Static Files
  54. uses: actions/upload-artifact@v3
  55. with:
  56. name: npm-static-files
  57. path: dashboard/build/
  58. porter-deploy:
  59. runs-on: ubuntu-latest
  60. needs: [build-go, build-npm]
  61. steps:
  62. - name: Checkout code
  63. uses: actions/checkout@v3
  64. - name: Get Go Binaries
  65. uses: actions/download-artifact@v3
  66. with:
  67. name: go-binaries
  68. path: bin/
  69. - name: Get NPM static files
  70. uses: actions/download-artifact@v3
  71. with:
  72. name: npm-static-files
  73. path: build/
  74. - name: Set Github tag
  75. id: vars
  76. run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
  77. - name: Deploy stack
  78. timeout-minutes: 30
  79. uses: porter-dev/porter-cli-action@v0.1.0
  80. with:
  81. command: apply -f nonexistant-porter.yaml
  82. env:
  83. PORTER_CLUSTER: "11"
  84. PORTER_HOST: https://dashboard.internal-tools.getporter.dev
  85. PORTER_PROJECT: "8"
  86. PORTER_STACK_NAME: porter-ui
  87. PORTER_TAG: ${{ steps.vars.outputs.sha_short }}
  88. PORTER_TOKEN: ${{ secrets.PORTER_STACK_8_11 }}