porter_stack_porter-ui.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. go-version: '1.20.5'
  26. - name: Download Go Modules
  27. run: go mod download
  28. - name: Build Server Binary
  29. run: go build -ldflags="-w -s -X 'main.Version=production'" -tags ee -o ./bin/app ./cmd/app
  30. - name: Build Migration Binary
  31. run: go build -ldflags '-w -s' -tags ee -o ./bin/migrate ./cmd/migrate
  32. - name: Compress binaries
  33. run: |
  34. upx bin/* --best --lzma
  35. - name: Store Binaries
  36. uses: actions/upload-artifact@v3
  37. with:
  38. name: go-binaries
  39. path: bin/
  40. retention-days: 1
  41. build-npm:
  42. runs-on: ubuntu-latest
  43. steps:
  44. - name: Checkout code
  45. uses: actions/checkout@v3
  46. - name: Setup Node
  47. uses: actions/setup-node@v3
  48. with:
  49. node-version: 16
  50. - name: Install NPM Dependencies
  51. run: |
  52. cd dashboard
  53. npm i --legacy-peer-deps
  54. - name: Run NPM Build
  55. run: |
  56. cd dashboard
  57. npm run build
  58. - name: Store NPM Static Files
  59. uses: actions/upload-artifact@v3
  60. with:
  61. name: npm-static-files
  62. path: dashboard/build/
  63. retention-days: 1
  64. porter-deploy:
  65. runs-on: ubuntu-latest
  66. needs: [build-go, build-npm]
  67. steps:
  68. - name: Checkout code
  69. uses: actions/checkout@v3
  70. - name: Get Go Binaries
  71. uses: actions/download-artifact@v3
  72. with:
  73. name: go-binaries
  74. path: bin/
  75. - name: Get NPM static files
  76. uses: actions/download-artifact@v3
  77. with:
  78. name: npm-static-files
  79. path: build/
  80. - name: Set Github tag
  81. id: vars
  82. run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
  83. - name: Deploy stack
  84. timeout-minutes: 30
  85. uses: porter-dev/porter-cli-action@v0.1.0
  86. with:
  87. command: apply
  88. env:
  89. PORTER_CLUSTER: "11"
  90. PORTER_HOST: https://dashboard.internal-tools.porter.run
  91. PORTER_PROJECT: "8"
  92. PORTER_STACK_NAME: porter-ui
  93. PORTER_TAG: ${{ steps.vars.outputs.sha_short }}
  94. PORTER_TOKEN: ${{ secrets.PORTER_STACK_8_11 }}