main.yml 895 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. name: Go
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. # 如果 go 项目在 server 子目录
  8. paths:
  9. - './server/**'
  10. jobs:
  11. build:
  12. name: Build
  13. runs-on: ubuntu-latest
  14. steps:
  15. - name: Set up Go 1.13
  16. uses: actions/setup-go@v1
  17. with:
  18. go-version: 1.13
  19. id: go
  20. - name: Check out code into the Go module directory
  21. uses: actions/checkout@v2
  22. - name: Get dependencies
  23. run: |
  24. go get -v -t -d ./...
  25. if [ -f Gopkg.toml ]; then
  26. curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
  27. dep ensure
  28. fi
  29. working-directory: ./server
  30. - name: Build
  31. run: go build -v . -o output
  32. working-directory: ./server
  33. - name: artifact
  34. uses: actions/upload-artifact@v1
  35. with:
  36. name: artifact
  37. path: output