diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 87800f8..18a46b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,11 +48,18 @@ jobs: with: go-version: '1.25' - - name: Run GoReleaser (build-only) + - name: Run GoReleaser (snapshot, builds .deb packages) uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: '~> v2' - args: build --snapshot --clean + args: release --snapshot --clean --skip=publish,announce env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Debian packages + uses: actions/upload-artifact@v4 + with: + name: debian-packages + path: dist/*.deb + if-no-files-found: error diff --git a/.gitignore b/.gitignore index b8057d4..ba6f1ae 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ config.yaml # Logs *.log +# GoReleaser output +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml index 59e9940..31c3cff 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -34,6 +34,32 @@ archives: - config.example.yaml - fwatch.service +nfpms: + - id: fwatch + ids: + - fwatch + package_name: fwatch + vendor: polarn + homepage: "https://github.com/polarn/fwatch" + maintainer: "Marcus Johansson " + description: "A lightweight, configurable file organizer that automatically moves files based on their extensions" + license: "Apache-2.0" + formats: + - deb + bindir: /usr/bin + section: utils + file_name_template: >- + {{ .ProjectName }}_{{ .Version }}_{{ .Arch }} + contents: + - src: ./fwatch.service + dst: /usr/lib/systemd/user/fwatch.service + - src: ./config.example.yaml + dst: /usr/share/doc/fwatch/config.example.yaml + - src: ./README.md + dst: /usr/share/doc/fwatch/README.md + - src: ./LICENSE + dst: /usr/share/doc/fwatch/LICENSE + snapshot: version_template: "{{ incpatch .Version }}-next" @@ -59,6 +85,11 @@ release: yay -S fwatch-bin ``` + **Debian/Ubuntu:** + ```bash + sudo dpkg -i fwatch_{{ trimprefix .Tag "v" }}_amd64.deb + ``` + **Manual Installation:** Download the appropriate binary for your platform below. diff --git a/CLAUDE.md b/CLAUDE.md index 91a0229..e46f1a7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -9,8 +9,10 @@ destination directories by extension. All logic lives in `main.go`. `moveFile` falls back to copy+delete on cross-device rename failures. - `config.example.yaml` — reference config. Real config is `$XDG_CONFIG_HOME/fwatch/config.yaml`, else `~/.config/fwatch/config.yaml`. -- `fwatch.service` — example systemd **user** unit (ExecStart `/usr/local/bin/fwatch`). -- `.goreleaser.yml` — builds, archives, AUR (`fwatch-bin`) publishing. +- `fwatch.service` — the systemd **user** unit, single source of truth: shipped in the + archives, installed live by the `.deb` and as docs by the AUR package. ExecStart is + `/usr/bin/fwatch`, the path both packages install to. +- `.goreleaser.yml` — builds, archives, `.deb` packages (nfpms), AUR (`fwatch-bin`) publishing. - `.github/workflows/` — `test.yml` (vet/test/build on PRs and main), `release.yml` (goreleaser, triggered by `X.Y.Z` tags). diff --git a/README.md b/README.md index 2a5a06e..060ff9f 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,21 @@ yay -S fwatch-bin paru -S fwatch-bin ``` +### Debian / Ubuntu + +Download the `.deb` for your architecture from the [releases page](https://github.com/polarn/fwatch/releases) and install it: + +```bash +sudo dpkg -i fwatch_*_amd64.deb +``` + +The package installs the binary to `/usr/bin/fwatch` and a systemd **user** unit to +`/usr/lib/systemd/user/fwatch.service`, so after configuring fwatch you can run: + +```bash +systemctl --user enable --now fwatch.service +``` + ### Pre-built Binaries Download the latest release for your platform from the [releases page](https://github.com/polarn/fwatch/releases). @@ -100,6 +115,9 @@ systemctl --user status fwatch.service journalctl --user -u fwatch.service -f ``` +**Note:** The unit's `ExecStart` is `/usr/bin/fwatch`, where the deb and AUR packages install +the binary. If you installed manually to `/usr/local/bin`, edit `ExecStart` to match. + **Note:** Make sure you've already configured fwatch (see [Configuration](#configuration) section above) before starting the service. ## Configuration Options diff --git a/fwatch.service b/fwatch.service index caf3d15..7766502 100644 --- a/fwatch.service +++ b/fwatch.service @@ -5,8 +5,9 @@ After=network.target [Service] Type=simple -# Use absolute path to the fwatch binary -ExecStart=/usr/local/bin/fwatch +# Path the deb and AUR packages install the binary to. +# Adjust if you installed manually to /usr/local/bin. +ExecStart=/usr/bin/fwatch # Restart policy Restart=always