diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 9ca4871e..cbc2a657 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -11,7 +11,6 @@ on: - 'windows**' - '**.go' - 'go.*' - - '.goreleaser.yaml' - 'config' - '!**.md' pull_request: @@ -20,7 +19,6 @@ on: - 'windows**' - '**.go' - 'go.*' - - '.goreleaser.yaml' - 'config' - '!**.md' workflow_dispatch: @@ -101,34 +99,30 @@ jobs: & "C:\Program Files\Windows Defender\MpCmdRun.exe" -ListAllDynamicSignatures - uses: actions/checkout@v4 with: - # KEEP fetch-depth for goreleaser - # https://github.com/goreleaser/goreleaser-action/blob/696b757ee8f3742e68b261173b9eeeb96306a57f/README.md?plain=1#L77 + # KEEP fetch-depth for gh command fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: 'go.mod' cache-dependency-path: 'go.sum' - - name: Install goreleaser - uses: goreleaser/goreleaser-action@v6 - with: - install-only: true - version: 'v2.4.8' # selfup { "extract": "\\d[^']+", "replacer": ["bash", "-c", "goreleaser --version | grep 'GitVersion:'"], "nth": 2 } - name: List files - before build run: Get-ChildItem - name: Build winit-* - run: goreleaser build --snapshot --clean + # unnecessary to build wsl-* here, it should be done in linux runners + run: | + go build -o 'dist/' ./cmd/winit-reg + go build -o 'dist/' ./cmd/winit-conf - name: List files - after build run: | Get-ChildItem Get-ChildItem -Recurse .\dist - # https://github.com/goreleaser/goreleaser-action/tree/5fdedb94abba051217030cc86d4523cf3f02243d#upload-artifacts - name: Upload artifact id: upload-artifact uses: actions/upload-artifact@v4 with: name: winit - path: dist/**/*.exe + path: dist - name: Download the artifact to make sure we can actually use it env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -166,20 +160,22 @@ jobs: # - note: https://github.com/microsoft/winget-cli/blob/b07d2ebb7d865f95320e2bc708a2d1efb2152c5a/README.md#L14 - name: Rebel against unacceptable default run: | - .\dist\winit-reg_windows_amd64_v1\winit-reg.exe list - .\dist\winit-reg_windows_amd64_v1\winit-reg.exe run --all + .\dist\winit-reg.exe list + .\dist\winit-reg.exe run --all # This logics can be finished even if tools are not installed - name: Put config files around terminals run: | Write-Host "$PROFILE" - .\dist\winit-conf_windows_amd64_v1\winit-conf.exe run + .\dist\winit-conf.exe run Install-Module -Force -Name PSFzfHistory - .\dist\winit-conf_windows_amd64_v1\winit-conf.exe generate -path="config/powershell/Profile.ps1" > "$PROFILE" + .\dist\winit-conf.exe generate -path="config/powershell/Profile.ps1" > "$PROFILE" - name: Make sure it correctly copied some config files run: | Test-Path "$PROFILE" Get-Content "$PROFILE" - name: Release the product if: startsWith(github.ref, 'refs/tags/') + env: + GH_TOKEN: ${{ github.token }} run: | - goreleaser release --clean + gh release create --verify-tag "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" dist/*.exe diff --git a/.goreleaser.yaml b/.goreleaser.yaml deleted file mode 100644 index 8a9bf63a..00000000 --- a/.goreleaser.yaml +++ /dev/null @@ -1,70 +0,0 @@ -# This is an example .goreleaser.yml file with some sensible defaults. -# Make sure to check the documentation at https://goreleaser.com -before: - hooks: - # # You may remove this if you don't use go modules. - # - go mod tidy - # # you may remove this if you don't need go generate - # - go generate ./... -# https://github.com/orgs/goreleaser/discussions/1531 -builds: - - id: winit-reg - binary: winit-reg - env: - - CGO_ENABLED=0 - main: ./cmd/winit-reg - goos: - - windows - goarch: - - amd64 - - id: winit-conf - binary: winit-conf - env: - - CGO_ENABLED=0 - main: ./cmd/winit-conf - goos: - - windows - goarch: - - amd64 - -archives: - - format: tar.gz - # this name template makes the OS and Arch compatible with the results of uname. - name_template: >- - {{ .ProjectName }}_ - {{- title .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 - {{- else if eq .Arch "386" }}i386 - {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}v{{ .Arm }}{{ end }} - # use zip for windows archives - format_overrides: - - goos: windows - format: zip -checksum: - name_template: 'checksums.txt' -snapshot: - name_template: '{{ incpatch .Version }}-next' -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' -# The lines beneath this are called `modelines`. See `:help modeline` -# Feel free to remove those if you don't want/use them. -# yaml-language-server: $schema=https://goreleaser.com/static/schema.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj - -git: - # Tags to be ignored by GoReleaser. - # This means that GoReleaser will not pick up tags that match any of the - # provided values as either previous or current tags. - # - # Since: v1.21 - # Templates: allowed - ignore_tags: - - nixos-24.05-release - - nixos-24.11-release - - # I can't use ignore_tag_prefixes, it is GoReleaser Pro only feature :< diff --git a/cmd/deps/main.go b/cmd/deps/main.go index 8f529c40..0ecc1cc0 100644 --- a/cmd/deps/main.go +++ b/cmd/deps/main.go @@ -18,7 +18,6 @@ func main() { {Path: "trufflehog", Args: []string{"--version"}}, {Path: "stylua", Args: []string{"--version"}}, {Path: "nixpkgs-lint", Args: []string{"--version"}}, - {Path: "goreleaser", Args: []string{"--version"}}, {Path: "selfup", Args: []string{"-version"}}, // Even if nixfmt returns old version as v0.5.0, the actual code is latest diff --git a/flake.nix b/flake.nix index 61a97fa7..f785b4c5 100644 --- a/flake.nix +++ b/flake.nix @@ -125,7 +125,6 @@ typos typos-lsp # For zed-editor typos extension go_1_23 - goreleaser trivy markdownlint-cli2