Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Add Linux distribution support (Snap, APT, RPM) #44

@rianjs

Description

@rianjs

Summary

Add Linux distribution support for jira-ticket-cli (jtk), enabling users to install via Snap Store, APT (Debian/Ubuntu), and DNF/YUM (Fedora/RHEL/CentOS).

Reference implementation: confluence-cli PR #96 and the linux-distribution.md guide.


Current State

  • GoReleaser already builds Linux binaries for amd64/arm64
  • No nfpms section (no .deb/.rpm packages generated)
  • No snap/snapcraft.yaml
  • No snap or linux-packages jobs in release workflow

Tasks

Part 1: GoReleaser nfpms Configuration

  • Add nfpms section to .goreleaser.yml (after archives, before homebrew_casks):
# Linux packages (.deb and .rpm)
nfpms:
  - id: jtk
    package_name: jtk
    vendor: Open CLI Collective
    homepage: https://github.com/open-cli-collective/jira-ticket-cli
    maintainer: Open CLI Collective <https://github.com/open-cli-collective>
    description: Command-line interface for Jira Cloud
    license: MIT
    formats:
      - deb
      - rpm
    bindir: /usr/bin
    contents:
      - src: LICENSE
        dst: /usr/share/licenses/jtk/LICENSE
  • Test locally: goreleaser check && goreleaser build --snapshot --clean
  • Verify dist/*.deb and dist/*.rpm are generated

Part 2: Snap Package Setup

  • Check snap name availability at https://snapcraft.io (try jtk first, fallback to ocli-jira)
  • Register the snap name: snapcraft login && snapcraft register <snap-name>
  • Create snap/snapcraft.yaml:
name: <snap-name>  # jtk or ocli-jira
base: core22
version: git
summary: Command-line interface for Jira Cloud
description: |
  jtk is a CLI for managing Jira Cloud tickets.

  Features:
  - List, create, update, and search issues
  - Manage sprints and boards
  - Add comments and perform transitions
  - Table, JSON, and plain output formats

  Run 'jtk config set' to configure your Jira credentials.

grade: stable
confinement: strict

architectures:
  - build-on: amd64
  - build-on: arm64

plugs:
  dot-config-jira-ticket-cli:
    interface: personal-files
    read:
      - $HOME/.config/jira-ticket-cli
    write:
      - $HOME/.config/jira-ticket-cli

apps:
  <snap-name>:
    command: bin/jtk
    plugs:
      - home
      - network
      - dot-config-jira-ticket-cli
    aliases:
      - jtk  # Only needed if snap-name != jtk

parts:
  jtk:
    plugin: go
    source: .
    build-snaps:
      - go/1.24/stable
    build-environment:
      - CGO_ENABLED: "0"
    override-build: |
      # Get version from git
      VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev")
      COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
      DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

      # Build with ldflags
      go build -o $SNAPCRAFT_PART_INSTALL/bin/jtk \
        -ldflags "-s -w \
          -X github.com/open-cli-collective/jira-ticket-cli/internal/version.Version=${VERSION} \
          -X github.com/open-cli-collective/jira-ticket-cli/internal/version.Commit=${COMMIT} \
          -X github.com/open-cli-collective/jira-ticket-cli/internal/version.BuildDate=${DATE}" \
        ./cmd/jtk
  • Export Snapcraft credentials: snapcraft export-login --snaps=<snap-name> --acls=package_upload /tmp/snapcraft-creds.txt
  • Add to repo secrets: gh secret set SNAPCRAFT_STORE_CREDENTIALS --repo open-cli-collective/jira-ticket-cli < /tmp/snapcraft-creds.txt
  • Clean up: rm /tmp/snapcraft-creds.txt

Part 3: linux-packages Repository Integration

  • Create a Personal Access Token (PAT):
  • Add dispatch token: gh secret set LINUX_PACKAGES_DISPATCH_TOKEN --repo open-cli-collective/jira-ticket-cli
  • Update linux-packages/README.md to add jtk to the Available Packages table:
    | `jtk` | Command-line interface for Jira Cloud | [jira-ticket-cli](https://github.com/open-cli-collective/jira-ticket-cli) |

Part 4: Release Workflow Updates

  • Add snap job to .github/workflows/release.yml:
  snap:
    needs: goreleaser
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Build snap
        uses: snapcore/action-build@v1
        id: build

      - name: Publish to Snapcraft Store
        uses: snapcore/action-publish@v1
        env:
          SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
        with:
          snap: ${{ steps.build.outputs.snap }}
          release: stable
  • Add linux-packages job to .github/workflows/release.yml:
  linux-packages:
    needs: goreleaser
    runs-on: ubuntu-latest
    steps:
      - name: Trigger linux-packages repo update
        uses: peter-evans/repository-dispatch@v3
        with:
          token: ${{ secrets.LINUX_PACKAGES_DISPATCH_TOKEN }}
          repository: open-cli-collective/linux-packages
          event-type: package-release
          client-payload: |-
            {
              "package": "jtk",
              "version": "${{ github.ref_name }}",
              "repo": "open-cli-collective/jira-ticket-cli"
            }

Part 5: README Documentation

  • Update README.md with Linux installation instructions under the Installation section:

Snap (recommended)

sudo snap install <snap-name>

APT (Debian/Ubuntu)

# Add the GPG key
curl -fsSL https://open-cli-collective.github.io/linux-packages/keys/gpg.asc | sudo gpg --dearmor -o /usr/share/keyrings/open-cli-collective.gpg

# Add the repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/open-cli-collective.gpg] https://open-cli-collective.github.io/linux-packages/apt stable main" | sudo tee /etc/apt/sources.list.d/open-cli-collective.list

# Install
sudo apt update
sudo apt install jtk

Note: This is our third-party APT repository, not official Debian/Ubuntu repos.

DNF/YUM (Fedora/RHEL/CentOS)

# Add the repository
sudo tee /etc/yum.repos.d/open-cli-collective.repo << 'EOF'
[open-cli-collective]
name=Open CLI Collective
baseurl=https://open-cli-collective.github.io/linux-packages/rpm
enabled=1
gpgcheck=1
gpgkey=https://open-cli-collective.github.io/linux-packages/keys/gpg.asc
EOF

# Install
sudo dnf install jtk

Note: This is our third-party RPM repository, not official Fedora/RHEL repos.

Binary download

Download .deb, .rpm, or .tar.gz from the Releases page.


Part 6: Pre-Release Verification

  • Verify all secrets are configured:

    gh secret list --repo open-cli-collective/jira-ticket-cli

    Expected: SNAPCRAFT_STORE_CREDENTIALS, LINUX_PACKAGES_DISPATCH_TOKEN (plus existing secrets)

  • Validate GoReleaser config: goreleaser check


Secrets Checklist

Secret Purpose Status
SNAPCRAFT_STORE_CREDENTIALS Publish to Snap Store To be added
LINUX_PACKAGES_DISPATCH_TOKEN Trigger linux-packages workflow To be added
TAP_GITHUB_TOKEN Homebrew tap updates Already exists
CHOCOLATEY_API_KEY Chocolatey publishing Already exists
WINGET_GITHUB_TOKEN Winget PR creation Already exists

Files to Create/Modify

File Action
.goreleaser.yml Add nfpms section
snap/snapcraft.yaml Create new file
.github/workflows/release.yml Add snap and linux-packages jobs
README.md Add Linux installation instructions
linux-packages/README.md Add jtk to packages table (separate PR)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions