build.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: Go
  2. on:
  3. push:
  4. branches: [ master, tmp ]
  5. pull_request:
  6. branches: [ master, tmp ]
  7. jobs:
  8. build:
  9. name: Build
  10. strategy:
  11. matrix:
  12. os: [ubuntu-latest]
  13. include:
  14. - os: ubuntu-latest
  15. path: |
  16. ~/.cache/go-build
  17. ~/go/pkg/mod
  18. runs-on: ubuntu-latest
  19. steps:
  20. - name: Set up Go 1.13
  21. uses: actions/setup-go@v1
  22. with:
  23. go-version: 1.13
  24. id: go
  25. - name: Check out code into the Go module directory
  26. uses: actions/checkout@v2
  27. - name: cache
  28. id: cache
  29. uses: actions/cache@v2
  30. with:
  31. path: ${{ matrix.path }}
  32. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  33. restore-keys: |
  34. ${{ runner.os }}-go-
  35. - name: Get dependencies
  36. run: |
  37. go get
  38. if [ -f Gopkg.toml ]; then
  39. curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
  40. dep ensure
  41. fi
  42. working-directory: ./
  43. - name: Build
  44. run: go build convert.go
  45. working-directory: ./
  46. - name: docker build
  47. run: |
  48. docker login --username=${{ secrets.USERNAME }} --password ${{ secrets.PASSWORD }} ccr.ccs.tencentyun.com
  49. docker build . -t ccr.ccs.tencentyun.com/jianboy/wordtohtml:v1.0.5
  50. - name: docker push
  51. run: |
  52. docker push ccr.ccs.tencentyun.com/jianboy/wordtohtml:v1.0.5
  53. docker tag $(docker images ccr.ccs.tencentyun.com/jianboy/wordtohtml:v1.0.5 -q) ccr.ccs.tencentyun.com/jianboy/wordtohtml:latest
  54. docker push ccr.ccs.tencentyun.com/jianboy/wordtohtml:latest