From abda498ca6bcac2265b6003fa4c2dc668ee68ebd Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Wed, 18 Mar 2026 10:12:57 -0400 Subject: [PATCH 1/3] feat: Added classic snap packaging --- .github/workflows/package.yml | 34 ++++++++++++++++++++++ snap/snapcraft.yaml | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 snap/snapcraft.yaml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2324921..9f18c47 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -68,3 +68,37 @@ jobs: with: name: framework-tool-rpm path: target/generate-rpm/*.rpm + + build-snap: + name: Build Snap + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v6 + + - name: Build snap + uses: snapcore/action-build@v1 + id: build + + - name: Upload snap artifact + uses: actions/upload-artifact@v6 + with: + name: framework-tool-snap + path: ${{ steps.build.outputs.snap }} + + - name: Publish to edge channel + if: github.ref == 'refs/heads/main' + uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} + with: + snap: ${{ steps.build.outputs.snap }} + release: edge + + - name: Publish to candidate channel + if: github.ref_type == 'tag' || github.event_name == 'release' + uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} + with: + snap: ${{ steps.build.outputs.snap }} + release: candidate diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 0000000..f275ece --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,55 @@ +name: framework-tool +base: core24 +adopt-info: framework-tool +summary: CLI tool to inspect and control Framework Computer systems +description: | + framework_tool is a CLI utility to interact with Framework Computer laptop + and desktop firmware and hardware. Features include: + . + - Firmware inspection and updates (BIOS, EC, PD controllers, retimers) + - System status monitoring (power, thermal, sensors, USB-C ports) + - Hardware configuration (keyboard backlight, battery charge limits, fan control) + - Expansion card management (HDMI/DP/audio cards) + - Framework 16 specific features (input deck, expansion bay) + - NVIDIA GPU support + . + Note: Most features require root privileges (sudo framework-tool ...). + +grade: stable +confinement: classic +compression: lzo + +parts: + framework-tool: + plugin: rust + source: . + build-packages: + - libhidapi-dev + - libusb-1.0-0-dev + - libudev-dev + - pkg-config + stage-packages: + - libhidapi-hidraw0 + - libusb-1.0-0 + - libudev1 + override-pull: | + craftctl default + VERSION=$(craftctl get version) + if [ -z $VERSION ]; then + VERSION=$(git describe --tags --abbrev=10) + craftctl set version=$VERSION + fi + override-build: | + cd "${CRAFT_PART_SRC}" + cargo build --release -p framework_tool --features nvidia + install -Dm755 target/release/framework_tool "${CRAFT_PART_INSTALL}/bin/framework_tool" + install -Dm644 "${CRAFT_PART_SRC}/completions/bash/framework_tool" \ + "${CRAFT_PART_INSTALL}/share/bash-completion/completions/framework_tool" + install -Dm644 "${CRAFT_PART_SRC}/completions/zsh/_framework_tool" \ + "${CRAFT_PART_INSTALL}/share/zsh/site-functions/_framework_tool" + install -Dm644 "${CRAFT_PART_SRC}/completions/fish/framework_tool.fish" \ + "${CRAFT_PART_INSTALL}/share/fish/vendor_completions.d/framework_tool.fish" + +apps: + framework-tool: + command: bin/framework_tool From 8cf6fd97e76861b3ccfce7bfb0a263c0d4ba34e1 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 13 Apr 2026 11:31:04 +0800 Subject: [PATCH 2/3] snap: Only release on release not tag Avoid releasing twice --- .github/workflows/package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 9f18c47..4e58508 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -95,7 +95,7 @@ jobs: release: edge - name: Publish to candidate channel - if: github.ref_type == 'tag' || github.event_name == 'release' + if: github.event_name == 'release' uses: snapcore/action-publish@v1 env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} From bba83d331192e90fe3d28ffb2b6f551515e5b882 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 13 Apr 2026 11:39:11 +0800 Subject: [PATCH 3/3] snap: Properly fetch and get tags Also fall back if there's no tag Signed-off-by: Daniel Schaefer --- .github/workflows/package.yml | 2 ++ snap/snapcraft.yaml | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 4e58508..894b258 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -74,6 +74,8 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 + with: + fetch-depth: 0 - name: Build snap uses: snapcore/action-build@v1 diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f275ece..0ac5599 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -35,9 +35,9 @@ parts: override-pull: | craftctl default VERSION=$(craftctl get version) - if [ -z $VERSION ]; then - VERSION=$(git describe --tags --abbrev=10) - craftctl set version=$VERSION + if [ -z "$VERSION" ]; then + VERSION=$(git describe --tags --abbrev=10 2>/dev/null || echo "0.0.0+git$(git rev-parse --short=10 HEAD)") + craftctl set version="$VERSION" fi override-build: | cd "${CRAFT_PART_SRC}"