-
Notifications
You must be signed in to change notification settings - Fork 0
Use goreleaser-rust and tidy packaging #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d52ddd4
f7cfccf
5b8b60f
0cb4c5a
88b47a9
c49788c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,8 +41,8 @@ Group=comenq | |
|
|
||
| # The command to start the daemon | ||
| # Assumes the binary is installed to /usr/bin/comenqd | ||
| # The configuration file is expected at /etc/comenq/config.toml | ||
| ExecStart=/usr/bin/comenqd --config /etc/comenq/config.toml | ||
| # The configuration file is expected at /etc/comenqd/config.toml | ||
| ExecStart=/usr/bin/comenqd --config /etc/comenqd/config.toml | ||
|
|
||
| # Security Hardening | ||
| # Disallow any privileges | ||
|
|
@@ -71,13 +71,13 @@ WantedBy=multi-user.target | |
| ``` | ||
|
|
||
| **Note:** This unit file assumes a configuration file at | ||
| `/etc/comenq/config.toml`. You should provide a default configuration file with | ||
| your package. | ||
| `/etc/comenqd/config.toml`. A default configuration file must ship with the | ||
| package. | ||
|
|
||
| #### Step 2: Create a Default Configuration File | ||
|
|
||
| Create a default `config.toml` file to be included in the packages. Place it at | ||
| `packaging/comenqd/config.toml`. | ||
| `packaging/config/comenqd.toml`. | ||
|
|
||
| ```toml | ||
| # Default configuration for comenqd | ||
|
|
@@ -88,120 +88,7 @@ Create a default `config.toml` file to be included in the packages. Place it at | |
| # cooldown_period_seconds = 960 | ||
| ``` | ||
|
|
||
| #### Step 3: Create the `.goreleaser.yaml` Configuration | ||
|
|
||
| Now, create the main GoReleaser configuration file in the root of your | ||
| repository. This file defines the entire release process. | ||
|
|
||
| #### `.goreleaser.yaml` | ||
|
|
||
| ```yaml | ||
| # .goreleaser.yaml | ||
| # Visit https://goreleaser.com/customization/ for more options | ||
| project_name: comenq | ||
|
|
||
| # This section is only needed if you use the GoReleaser Go proxy | ||
| # to build. Since we are building a Rust project, we will override | ||
| # the build step entirely. | ||
| builds: | ||
| - id: comenq | ||
| binary: comenq | ||
| main: ./crates/comenq | ||
| goos: [linux, darwin] | ||
| goarch: [amd64, arm64] | ||
| # We use a custom build command with Cargo | ||
| builder: go | ||
| hooks: | ||
| pre: | ||
| - cmd: cargo build --release --package comenq --target {{ .TARGET }} | ||
| - cmd: cp target/{{ .TARGET }}/release/comenq {{ .Path }} | ||
| - id: comenqd | ||
| binary: comenqd | ||
| main: ./crates/comenqd | ||
| goos: [linux, darwin] | ||
| goarch: [amd64, arm64] | ||
| # We use a custom build command with Cargo | ||
| builder: go | ||
| hooks: | ||
| pre: | ||
| - cmd: cargo build --release --package comenqd --target {{ .TARGET }} | ||
| - cmd: cp target/{{ .TARGET }}/release/comenqd {{ .Path }} | ||
|
|
||
| # Create archives of the binaries. | ||
| archives: | ||
| - id: default | ||
| name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
| format: tar.gz | ||
| files: | ||
| - LICENSE | ||
| - README.md | ||
|
|
||
| # Configuration for creating Linux packages (.deb and .rpm) | ||
| nfpms: | ||
| - id: comenq-packages | ||
| package_name: comenq | ||
| vendor: "Your Name" | ||
| homepage: "https://github.com/leynos/comenq" | ||
| maintainer: "Your Name <your.email@example.com>" | ||
| description: "Client for the Comenq notification system." | ||
| license: MIT | ||
| formats: | ||
| - deb | ||
| - rpm | ||
| # Target only the 'comenq' build | ||
| builds: | ||
| - comenq | ||
|
|
||
| - id: comenqd-packages | ||
| package_name: comenqd | ||
| vendor: "Your Name" | ||
| homepage: "https://github.com/leynos/comenq" | ||
| maintainer: "Your Name <your.email@example.com>" | ||
| description: "Daemon for the Comenq notification system." | ||
| license: MIT | ||
| formats: | ||
| - deb | ||
| - rpm | ||
| # Target only the 'comenqd' build | ||
| builds: | ||
| - comenqd | ||
| # Files to include in the package | ||
| contents: | ||
| # The systemd unit file | ||
| - src: packaging/linux/comenqd.service | ||
| dst: /lib/systemd/system/comenqd.service | ||
| # The default configuration file | ||
| - src: packaging/comenqd/config.toml | ||
| dst: /etc/comenq/config.toml | ||
| type: config | ||
| # Scripts to run on installation | ||
| scripts: | ||
| preinstall: "packaging/linux/preinstall.sh" | ||
| postinstall: "packaging/linux/postinstall.sh" | ||
| preremove: "packaging/linux/preremove.sh" | ||
|
|
||
| # Create a GitHub release | ||
| release: | ||
| github: | ||
| owner: leynos | ||
| name: comenq | ||
| draft: true # Set to false to auto-publish | ||
|
|
||
| # Generate a changelog from commit messages | ||
| changelog: | ||
| sort: asc | ||
| filters: | ||
| # Exclude chore, style, and test commits from the changelog | ||
| exclude: | ||
| - '^docs:' | ||
| - '^test:' | ||
| - '^chore:' | ||
| - '^style:' | ||
| - 'Merge pull request' | ||
| - 'Merge branch' | ||
| ``` | ||
|
|
||
| #### Step 4: Create Installation Scripts | ||
| #### Step 3: Create Installation Scripts | ||
|
|
||
| The `systemd` unit file requires a dedicated user. These scripts will create | ||
| the `comenq` user and group upon installation. | ||
|
|
@@ -250,7 +137,7 @@ fi | |
|
|
||
| Make these scripts executable: `chmod +x packaging/linux/*.sh`. | ||
|
|
||
| #### Step 5: Update the GitHub Actions Workflow | ||
| #### Step 4: Update the GitHub Actions Workflow | ||
|
|
||
| Finally, modify your existing `.github/workflows/release.yml` to use | ||
| GoReleaser. This workflow will trigger when you push a new tag (e.g., `v1.2.3`). | ||
|
|
@@ -319,7 +206,7 @@ Create `packaging/darwin/comenqd.plist`: | |
| <array> | ||
| <string>/usr/local/bin/comenqd</string> | ||
| <string>--config</string> | ||
| <string>/usr/local/etc/comenq/config.toml</string> | ||
| <string>/usr/local/etc/comenqd/config.toml</string> | ||
| </array> | ||
| <key>RunAtLoad</key> | ||
| <true/> | ||
|
|
@@ -383,7 +270,7 @@ brews: | |
|
|
||
| # The service block for `comenqd` | ||
| service: | | ||
| run [opt_bin/"comenqd", "--config", etc/"comenq/config.toml"] | ||
| run [opt_bin/"comenqd", "--config", etc/"comenqd/config.toml"] | ||
| keep_alive true | ||
| log_path var/"log/comenq/comenqd.log" | ||
| error_log_path var/"log/comenq/comenqd.err" | ||
|
|
@@ -392,20 +279,16 @@ brews: | |
| install: | | ||
| bin.install "comenq" | ||
| bin.install "comenqd" | ||
| (etc/"comenq").mkpath | ||
| etc.install "config.toml" => "comenq/config.toml" | ||
| (etc/"comenqd").mkpath | ||
| etc.install "config.toml" => "comenqd/config.toml" | ||
| (var/"log/comenq").mkpath | ||
|
Comment on lines
+282
to
284
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix missing configuration file in Homebrew formula
Patch either archive or formula so both sides agree: # Option A (preferred): expose the config at archive root
archives:
files:
- LICENSE
- README.md
- - packaging/config/comenqd.toml
+ - src: packaging/config/comenqd.toml
+ dst: config.toml
# Option B: keep directory structure and reference it correctly in the formula
- etc.install "config.toml" => "comenqd/config.toml"
+ etc.install "packaging/config/comenqd.toml" => "comenqd/config.toml"Choose one approach and keep the pathing consistent throughout.
🤖 Prompt for AI Agents |
||
| ``` | ||
|
|
||
| #### Step 3: Add the macOS Configuration File | ||
|
|
||
| The Homebrew formula will also install a default configuration. Add a copy for | ||
| macOS, perhaps identical to the Linux one, at `packaging/darwin/config.toml`. | ||
| Update the `brews.contents` section in `.goreleaser.yaml` to point to it if it | ||
| differs, or simply add it to the `files` section of the archive if it's | ||
| universal. For simplicity, let's assume the one at | ||
| `packaging/comenqd/config.toml` is sufficient and will be picked up by the | ||
| archive. | ||
| The Homebrew formula will also install a default configuration. Since the same | ||
| settings apply on both platforms, the shared `packaging/config/comenqd.toml` is | ||
| sufficient and will be picked up by the archive. | ||
|
|
||
| #### Step 4: Final `.goreleaser.yaml` | ||
|
|
||
|
|
@@ -416,27 +299,28 @@ configurations: | |
| # .goreleaser.yaml | ||
| project_name: comenq | ||
|
|
||
| plugins: | ||
| - import: github.com/goreleaser/goreleaser-rust@v1.6.0 | ||
|
|
||
| builds: | ||
| - id: comenq | ||
| binary: comenq | ||
| main: ./crates/comenq | ||
| goos: [linux, darwin] | ||
| goarch: [amd64, arm64] | ||
| builder: go | ||
| hooks: | ||
| pre: | ||
| - cmd: cargo build --release --package comenq --target {{ .TARGET }} | ||
| - cmd: cp target/{{ .TARGET }}/release/comenq {{ .Path }} | ||
| builder: rust | ||
| targets: | ||
| - x86_64-unknown-linux-gnu | ||
| - aarch64-unknown-linux-gnu | ||
| - x86_64-apple-darwin | ||
| - aarch64-apple-darwin | ||
| - id: comenqd | ||
| binary: comenqd | ||
| main: ./crates/comenqd | ||
| goos: [linux, darwin] | ||
| goarch: [amd64, arm64] | ||
| builder: go | ||
| hooks: | ||
| pre: | ||
| - cmd: cargo build --release --package comenqd --target {{ .TARGET }} | ||
| - cmd: cp target/{{ .TARGET }}/release/comenqd {{ .Path }} | ||
| builder: rust | ||
| targets: | ||
| - x86_64-unknown-linux-gnu | ||
| - aarch64-unknown-linux-gnu | ||
| - x86_64-apple-darwin | ||
| - aarch64-apple-darwin | ||
|
|
||
| archives: | ||
| - id: default | ||
|
|
@@ -445,7 +329,7 @@ archives: | |
| files: | ||
| - LICENSE | ||
| - README.md | ||
| - packaging/comenqd/config.toml | ||
| - packaging/config/comenqd.toml | ||
|
|
||
|
leynos marked this conversation as resolved.
|
||
| nfpms: | ||
| - id: comenq-packages | ||
|
|
@@ -470,8 +354,8 @@ nfpms: | |
| contents: | ||
| - src: packaging/linux/comenqd.service | ||
| dst: /lib/systemd/system/comenqd.service | ||
| - src: packaging/comenqd/config.toml | ||
| dst: /etc/comenq/config.toml | ||
| - src: packaging/config/comenqd.toml | ||
| dst: /etc/comenqd/config.toml | ||
| type: config | ||
| scripts: | ||
| preinstall: "packaging/linux/preinstall.sh" | ||
|
|
@@ -492,15 +376,15 @@ brews: | |
| license: "MIT" | ||
| builds: [comenq, comenqd] | ||
| service: | | ||
| run [opt_bin/"comenqd", "--config", etc/"comenq/config.toml"] | ||
| run [opt_bin/"comenqd", "--config", etc/"comenqd/config.toml"] | ||
| keep_alive true | ||
| log_path var/"log/comenq/comenqd.log" | ||
| error_log_path var/"log/comenq/comenqd.err" | ||
| install: | | ||
| bin.install "comenq" | ||
| bin.install "comenqd" | ||
| (etc/"comenq").mkpath | ||
| etc.install "config.toml" => "comenq/config.toml" | ||
| (etc/"comenqd").mkpath | ||
| etc.install "config.toml" => "comenqd/config.toml" | ||
| (var/"log/comenq").mkpath | ||
|
|
||
| release: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify config path consistency across codebase.
The configuration path has been updated to
packaging/config/comenqd.toml. Ensure all references throughout the codebase use the new path to prevent packaging inconsistencies.Also applies to: 55-55
🏁 Script executed:
Length of output: 2633
Update config path references to use
/etc/comenqd/config.tomlconsistentlyUpdate all hard-coded paths and documentation to match the new
comenqddirectory name:• .goreleaser.yaml (line 56): change
dst: /etc/comenq/config.toml→dst: /etc/comenqd/config.toml• Systemd service files: replace
--config /etc/comenq/config.toml→--config /etc/comenqd/config.toml• docs/roadmap.md (line 34): ensure path reads
/etc/comenqd/config.toml• docs/automated-cross-platform-packaging.md: replace every
/etc/comenq/config.toml,usr/local/etc/comenq/config.toml,etc/"comenq/config.toml"with/etc/comenqd/config.toml,usr/local/etc/comenqd/config.toml,etc/"comenqd/config.toml"• docs/comenq-design.md (lines 506, 517, 596, 625, 687, 690–692, 909): update all
/etc/comenqd/config.tomlreferences to match the new filename if any still use the old spellingFix these to prevent inconsistencies during packaging and installation.
🤖 Prompt for AI Agents