Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Add support for Debian packaging of the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
saidsay-so committed Nov 9, 2020
1 parent 9c84d74 commit 69ec7bd
Show file tree
Hide file tree
Showing 12 changed files with 231 additions and 50 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/cli-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build cli releases
on:
push:
tags:
- "fancy-cli-*"

jobs:
# Version is not properly formatted for direct use
filter:
runs-on: ubuntu-latest
name: Get version
outputs:
version: ${{ steps.filter.outputs.version }}
env:
VERSION: ${{ github.ref }}
steps:
- run: echo $VERSION | cut -d- -f3 | tr -d '[:space:]' | xargs printf "::set-output name=version::%s"
id: filter

create_release:
runs-on: ubuntu-latest
name: Create release
needs: filter
outputs:
upload_url: ${{ steps.create.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- uses: actions/create-release@v1
id: create
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ format('Fancy CLI v{0}', needs.filter.outputs.version) }}

ubuntu:
runs-on: ubuntu-latest
name: Build (Ubuntu)
needs: [create_release, filter]
steps:
- name: Install required packages
run: sudo apt update && sudo apt install -y libdbus-1-dev libgtk-3-dev build-essential debhelper dh-make devscripts fakeroot

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- uses: actions/checkout@v2

- name: Build the package
working-directory: ./cli
run: dpkg-buildpackage --no-sign

- name: Find the package file
id: find_file
run: |
path=$(find .. -name '*.deb' -print -quit)
echo "::set-output name=path::$path"
echo "::set-output name=name::$(basename $path)"
- name: Upload Debian package
id: upload-deb
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ steps.find_file.outputs.path }}
asset_name: ${{ steps.find_file.outputs.name }}
asset_content_type: application/vnd.debian.binary-package
109 changes: 61 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
all: cli service

.PHONY: cli service install uninstall
.PHONY: cli service

cli:
make -C cli/
Expand Down
3 changes: 2 additions & 1 deletion cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
BINDIR := $(DESTDIR)/usr/bin
TARGET_NAME := fancy-cli
NAME := fancy

all:
Expand All @@ -8,7 +9,7 @@ test:
cargo test --release

install:
[ -e "../Cargo.toml" ] && install -Dm744 -s ../target/release/"$(NAME)" "$(BINDIR)/$(NAME)" || install -Dm744 -s target/release/"$(NAME)" "$(BINDIR)/$(NAME)"
[ -e "../Cargo.toml" ] && install -Dm744 -s ../target/release/"$(TARGET_NAME)" "$(BINDIR)/$(NAME)" || install -Dm744 -s target/release/"$(TARGET_NAME)" "$(BINDIR)/$(NAME)"

uninstall:
rm "$(BINDIR)/$(NAME)"
6 changes: 6 additions & 0 deletions cli/debian/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The Debian Package fancy-cli
----------------------------

Comments regarding the Package

-- Musikid <[email protected]> Sat, 22 Aug 2020 23:19:09 +0000
5 changes: 5 additions & 0 deletions cli/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fancy-cli (0.1.0) unstable; urgency=medium

* Initial Release.

-- Musikid <[email protected]> Sat, 22 Aug 2020 23:19:09 +0000
1 change: 1 addition & 0 deletions cli/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
Loading

0 comments on commit 69ec7bd

Please sign in to comment.