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.

116 lines
3.7 KiB

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