build.yml 1021 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. name: build
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - main
  7. concurrency: ${{ github.workflow }}-${{ github.ref }}
  8. permissions:
  9. contents: write
  10. packages: write
  11. jobs:
  12. build:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: actions/checkout@v3
  16. with:
  17. fetch-depth: 0
  18. - run: git fetch --force --tags
  19. - uses: actions/setup-go@v5
  20. with:
  21. go-version: ">=1.23.2"
  22. cache: true
  23. cache-dependency-path: go.sum
  24. - run: go mod download
  25. - name: Cache GoReleaser build
  26. uses: actions/cache@v3
  27. with:
  28. path: |
  29. ~/.cache/go-build
  30. dist/
  31. .goreleaser.cache
  32. key: ${{ runner.os }}-go-build-${{ hashFiles('**/*.go') }}-${{ hashFiles('go.sum') }}
  33. restore-keys: |
  34. ${{ runner.os }}-go-build-
  35. - uses: goreleaser/goreleaser-action@v6
  36. with:
  37. distribution: goreleaser
  38. version: latest
  39. args: build --snapshot --clean