Skip to content
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

Packaging process and systemd service #43

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Create Releases
on:
push:
# Eventually run this only on release branches
# branches:
# - 'releases/**'

env:
CARGO_TERM_COLOR: always
CARGO_NET_GIT_FETCH_WITH_CLI: true

jobs:
release-linux:
name: Release Linux
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev libasound2-dev

- name: Setup Rust toolchain
run: rustup show

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'

- name: Build Linux tool and create deb
run: ./release/release.sh

- name: Upload Linux deb
uses: actions/upload-artifact@v3
with:
name: framework-inputmodule-rs-0.0.1.deb
path: release/framework-inputmodule-rs-0.0.1.deb
8 changes: 8 additions & 0 deletions release/framework-inputmodule-rs.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=framework-inputmodule-rs runs Framework Laptop 16 input modules and keeps their firmware up to date

[Service]
ExecStart=/usr/bin/framework-inputmodule-rs led-matrix --clock

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions release/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

cp -u ./ledmatrix/50-framework.rules /etc/udev/rules.d/
32 changes: 32 additions & 0 deletions release/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -euxo pipefail

: 'Checking for fpm Ruby gem, installing if not present'
installed=`gem list -i fpm` || true

if [ $installed = 'false' ]; then
gem install fpm
fi

: 'Running the build'
cargo build --target x86_64-unknown-linux-gnu -p inputmodule-control

: "Packaging"
fpm \
-s dir -t deb \
-p release/framework-inputmodule-rs-0.0.1.deb \
--name framework-inputmodule-rs \
--version 0.0.1 \
--architecture all \
--description "framework-inputmodule-rs runs Framework Laptop 16 input modules and keeps their firmware up to date" \
--url "https://frame.work" \
--maintainer "Framework <[email protected]>" \
--deb-systemd ./release/framework-inputmodule-rs.service \
--deb-systemd-enable \
--deb-systemd-auto-start \
--deb-systemd-restart-after-upgrade \
--after-install ./release/postinstall.sh \
target/x86_64-unknown-linux-gnu/debug/inputmodule-control=/usr/bin/framework-inputmodule-rs

: 'Packaging successful, install with "sudo dpkg -i <pkg-name>.deb"'