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.

117 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. 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
  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. runs-on: [ubuntu-latest]
  60. steps:
  61. -
  62. name: Checkout
  63. uses: actions/checkout@v2
  64. -
  65. name: Docker meta
  66. id: docker_meta
  67. uses: docker/metadata-action@v3
  68. with:
  69. images: |
  70. chrislusf/seaweedfs
  71. ghcr.io/chrislusf/seaweedfs
  72. tags: |
  73. type=raw,value=latest
  74. labels: |
  75. org.opencontainers.image.title=seaweedfs
  76. org.opencontainers.image.vendor=Chris Lu
  77. -
  78. name: Set up QEMU
  79. uses: docker/setup-qemu-action@v1
  80. -
  81. name: Set up Docker Buildx
  82. uses: docker/setup-buildx-action@v1
  83. with:
  84. buildkitd-flags: "--debug"
  85. -
  86. name: Login to Docker Hub
  87. if: github.event_name != 'pull_request'
  88. uses: docker/login-action@v1
  89. with:
  90. username: ${{ secrets.DOCKER_USERNAME }}
  91. password: ${{ secrets.DOCKER_PASSWORD }}
  92. -
  93. name: Login to GHCR
  94. if: github.event_name != 'pull_request'
  95. uses: docker/login-action@v1
  96. with:
  97. registry: ghcr.io
  98. username: ${{ secrets.GHCR_USERNAME }}
  99. password: ${{ secrets.GHCR_TOKEN }}
  100. -
  101. name: Build
  102. uses: docker/build-push-action@v2
  103. with:
  104. context: ./docker
  105. push: ${{ github.event_name != 'pull_request' }}
  106. file: ./docker/Dockerfile
  107. platforms: linux/amd64, linux/arm, linux/arm64, linux/386
  108. tags: ${{ steps.docker_meta.outputs.tags }}
  109. labels: ${{ steps.docker_meta.outputs.labels }}