You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.8 KiB

  1. # This is a basic workflow to help you get started with Actions
  2. name: "go: build versioned binaries"
  3. on:
  4. push:
  5. tags:
  6. - '*'
  7. # Allows you to run this workflow manually from the Actions tab
  8. workflow_dispatch:
  9. # A workflow run is made up of one or more jobs that can run sequentially or in parallel
  10. jobs:
  11. build-release-binaries:
  12. runs-on: ubuntu-latest
  13. strategy:
  14. matrix:
  15. goos: [linux, windows, darwin, freebsd, netbsd, openbsd]
  16. goarch: [amd64, arm, arm64, 386]
  17. exclude:
  18. - goarch: arm
  19. goos: darwin
  20. - goarch: 386
  21. goos: darwin
  22. - goarch: arm
  23. goos: windows
  24. - goarch: arm64
  25. goos: windows
  26. # Steps represent a sequence of tasks that will be executed as part of the job
  27. steps:
  28. # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
  29. - uses: actions/checkout@v2
  30. - name: Go Release Binaries Normal Volume Size
  31. uses: wangyoucao577/go-release-action@v1.20
  32. with:
  33. github_token: ${{ secrets.GITHUB_TOKEN }}
  34. goos: ${{ matrix.goos }}
  35. goarch: ${{ matrix.goarch }}
  36. overwrite: true
  37. pre_command: export CGO_ENABLED=0
  38. # build_flags: -tags 5BytesOffset # optional, default is
  39. ldflags: -extldflags -static -X github.com/chrislusf/seaweedfs/weed/util.COMMIT=${{github.sha}}
  40. # Where to run `go build .`
  41. project_path: weed
  42. binary_name: weed
  43. asset_name: "${{ matrix.goos }}_${{ matrix.goarch }}"
  44. - name: Go Release Large Disk Binaries
  45. uses: wangyoucao577/go-release-action@v1.20
  46. with:
  47. github_token: ${{ secrets.GITHUB_TOKEN }}
  48. goos: ${{ matrix.goos }}
  49. goarch: ${{ matrix.goarch }}
  50. overwrite: true
  51. pre_command: export CGO_ENABLED=0
  52. build_flags: -tags 5BytesOffset # optional, default is
  53. ldflags: -extldflags -static -X github.com/chrislusf/seaweedfs/weed/util.COMMIT=${{github.sha}}
  54. # Where to run `go build .`
  55. project_path: weed
  56. binary_name: weed
  57. asset_name: "${{ matrix.goos }}_${{ matrix.goarch }}_large_disk"
  58. build-latest-docker-image:
  59. needs: build-release-binaries
  60. runs-on: [ubuntu-latest]
  61. steps:
  62. -
  63. name: Checkout
  64. uses: actions/checkout@v2
  65. -
  66. name: Docker meta
  67. id: docker_meta
  68. uses: docker/metadata-action@v3
  69. with:
  70. images: |
  71. chrislusf/seaweedfs
  72. ghcr.io/chrislusf/seaweedfs
  73. tags: |
  74. type=raw,value=latest
  75. labels: |
  76. org.opencontainers.image.title=seaweedfs
  77. org.opencontainers.image.vendor=Chris Lu
  78. -
  79. name: Set up QEMU
  80. uses: docker/setup-qemu-action@v1
  81. -
  82. name: Set up Docker Buildx
  83. uses: docker/setup-buildx-action@v1
  84. with:
  85. buildkitd-flags: "--debug"
  86. -
  87. name: Login to Docker Hub
  88. if: github.event_name != 'pull_request'
  89. uses: docker/login-action@v1
  90. with:
  91. username: ${{ secrets.DOCKER_USERNAME }}
  92. password: ${{ secrets.DOCKER_PASSWORD }}
  93. -
  94. name: Login to GHCR
  95. if: github.event_name != 'pull_request'
  96. uses: docker/login-action@v1
  97. with:
  98. registry: ghcr.io
  99. username: ${{ secrets.GHCR_USERNAME }}
  100. password: ${{ secrets.GHCR_TOKEN }}
  101. -
  102. name: Build
  103. uses: docker/build-push-action@v2
  104. with:
  105. context: ./docker
  106. push: ${{ github.event_name != 'pull_request' }}
  107. file: ./docker/Dockerfile
  108. platforms: linux/amd64, linux/arm, linux/arm64, linux/386
  109. tags: ${{ steps.docker_meta.outputs.tags }}
  110. labels: ${{ steps.docker_meta.outputs.labels }}