main.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. name: Go
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. jobs:
  8. build:
  9. name: Build
  10. strategy:
  11. matrix:
  12. os: [ubuntu-latest, macos-latest, windows-latest]
  13. include:
  14. - os: ubuntu-latest
  15. path: |
  16. ~/.cache/go-build
  17. ~/go/pkg/mod
  18. - os: macos-latest
  19. path: |
  20. ~/Library/Caches/go-build
  21. ~/go/pkg/mod
  22. - os: windows-latest
  23. path: |
  24. %LocalAppData%\go-build
  25. ~/go/pkg/mod
  26. runs-on: ${{matrix.os}}
  27. steps:
  28. - name: Set up Go 1.13
  29. uses: actions/setup-go@v1
  30. with:
  31. go-version: 1.13
  32. id: go
  33. - name: Check out code into the Go module directory
  34. uses: actions/checkout@v2
  35. - name: cache
  36. id: cache
  37. uses: actions/cache@v2
  38. with:
  39. path: ${{ matrix.path }}
  40. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  41. restore-keys: |
  42. ${{ runner.os }}-go-
  43. - name: Get dependencies
  44. run: |
  45. go get -v -t -d ./...
  46. if [ -f Gopkg.toml ]; then
  47. curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
  48. dep ensure
  49. fi
  50. working-directory: ./server
  51. - name: Build
  52. run: go build -v . -o output
  53. working-directory: ./server
  54. - name: artifact
  55. uses: actions/upload-artifact@v1
  56. with:
  57. name: artifact
  58. path: output
  59. - name: Run GoReleaser
  60. uses: goreleaser/goreleaser-action@v1
  61. with:
  62. version: latest
  63. args: release --rm-dist
  64. key: ${{ secrets.YOUR_PRIVATE_KEY }}
  65. env:
  66. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}