action.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ---
  2. name: 'build-go'
  3. description: builds the go binaries for the app
  4. runs:
  5. using: "composite"
  6. steps:
  7. - name: Setup Go Cache
  8. uses: actions/cache@v3
  9. with:
  10. path: |
  11. ~/.cache/go-build
  12. ~/go/pkg/mod
  13. key: porter-go-${{ hashFiles('**/go.sum') }}
  14. restore-keys: porter-go-`
  15. - name: Setup Go
  16. uses: actions/setup-go@v4
  17. with:
  18. cache: false
  19. go-version-file: go.mod
  20. - name: Download Go Modules
  21. shell: bash
  22. run: go mod download
  23. - name: Build Server Binary
  24. shell: bash
  25. run: go build -ldflags="-w -s -X 'main.Version=production'" -tags ee -o ./bin/app ./cmd/app
  26. - name: Build Migration Binary
  27. shell: bash
  28. run: go build -ldflags '-w -s' -tags ee -o ./bin/migrate ./cmd/migrate
  29. - name: Compress binaries
  30. shell: bash
  31. run: |
  32. upx bin/* --best --lzma
  33. - name: Store Binaries
  34. uses: actions/upload-artifact@v3
  35. with:
  36. name: go-binaries
  37. path: bin/
  38. retention-days: 1