diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 11a4365..70d8361 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,31 +1,30 @@ -name: Release Binaries +name: goreleaser + on: - release: - types: [created] + pull_request: + push: + # run only against tags + tags: + - "v*" permissions: - contents: write - packages: write + contents: write jobs: - releases-matrix: - name: Release Go Binary - runs-on: ubuntu-latest - strategy: - matrix: - # build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 - goos: [linux, windows, darwin] - goarch: ["386", amd64, arm64] - exclude: - - goarch: "386" - goos: darwin - - steps: - - uses: actions/checkout@v4 - - uses: wangyoucao577/go-release-action@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - goos: ${{ matrix.goos }} - goarch: ${{ matrix.goarch }} - goversion: 1.22 - extra_files: LICENSE README.md + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: 1.22.x + - name: Run goreleaser + uses: goreleaser/goreleaser-action@v4 + with: + args: release --clean + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.gitignore b/.gitignore index 448dca3..e99f61c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,7 @@ repl-result-* # docs node_modules docs/.vitepress/cache -docs/.vitepress/dist \ No newline at end of file +docs/.vitepress/dist + +# goreleaser +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..28f582d --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,33 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 1 + +project_name: treefmt + +before: + hooks: + - go mod tidy + +builds: + - env: + - CGO_ENABLED=0 + ldflags: + - -s -w -X git.numtide.com/numtide/treefmt/build.Version=v{{.Version}} + goos: + - linux + - darwin + +changelog: + sort: asc + use: github + filters: + exclude: + - "^chore:" + - "^docs:" + - "^test:" diff --git a/nix/devshell.nix b/nix/devshell.nix index ded5714..b7c9d55 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -27,6 +27,7 @@ (with pkgs; [ # golang go + goreleaser delve pprof graphviz