Skip to content

Commit

Permalink
Arch packaging (#25)
Browse files Browse the repository at this point in the history
Arch packaging
  • Loading branch information
gr211 authored Jun 21, 2020
1 parent 857b470 commit 633eed4
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 10 deletions.
68 changes: 63 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,77 @@ jobs:
with:
command: build

- name: Create binary
- name: Create Debian package
env:
DESTDIR: '~/authenticator-rs-deb'
run: |
sudo mkdir -p $DESTDIR
mkdir -p $DESTDIR
RELEASE_VERSION=${{ github.event.release.tag_name }} DESTDIR=$DESTDIR make debian-pkg
- name: Upload Release Asset
- name: Upload Debian release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: '${{ github.event.release.upload_url }}'
asset_path: 'authenticator-rs-${{ github.event.release.tag_name }}-x86-64.deb'
asset_name: 'authenticator-rs-${{ github.event.release.tag_name }}-x86-64.deb'
asset_path: 'authenticator-rs-${{ github.event.release.tag_name }}-x86_64.deb'
asset_name: 'authenticator-rs-${{ github.event.release.tag_name }}-x86_64.deb'
asset_content_type: application/octet-stream

- name: Upload Debian release checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: '${{ github.event.release.upload_url }}'
asset_path: 'authenticator-rs-${{ github.event.release.tag_name }}-x86_64.deb.md5sum'
asset_name: 'authenticator-rs-${{ github.event.release.tag_name }}-x86_64.deb.md5sum'
asset_content_type: text/plain

arch:
runs-on: ubuntu-latest
needs: [ci]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare arch package metadata
run: |
wget https://github.com/grumlimited/authenticator-rs/releases/download/${{ github.event.release.tag_name }}/authenticator-rs-${{ github.event.release.tag_name }}-x86_64.deb -O data/arch/authenticator-rs/authenticator-rs-${{ github.event.release.tag_name }}-x86_64.deb
MD5_SUM=$(md5sum data/arch/authenticator-rs/authenticator-rs-${{ github.event.release.tag_name }}-x86_64.deb | awk '{print $1}')
awk -v q="'" -v MD5_SUM=$MD5_SUM -i inplace 'BEGINFILE{print "md5sums=(" q MD5_SUM q ")"}{print}' data/arch/authenticator-rs/PKGBUILD
awk -i inplace 'BEGINFILE{print "pkgver=${{ github.event.release.tag_name }}"}{print}' data/arch/authenticator-rs/PKGBUILD
- name: Validate PKGBUILD
id: validate-pkgbuild
uses: grumlimited/[email protected]
with:
target: pkgbuild
pkgbuild: data/arch/authenticator-rs/PKGBUILD

- name: Create arch package checksum file
run: |
sudo chown -R $USER .
md5sum data/arch/authenticator-rs/*.xz >> data/arch/authenticator-rs/authenticator-rs-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.xz.md5sum
- name: Upload Arch Linux release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: '${{ github.event.release.upload_url }}'
asset_path: 'data/arch/authenticator-rs/authenticator-rs-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.xz'
asset_name: 'authenticator-rs-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.xz'
asset_content_type: application/octet-stream

- name: Upload Arch Linux release checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: '${{ github.event.release.upload_url }}'
asset_path: 'data/arch/authenticator-rs/authenticator-rs-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.xz.md5sum'
asset_name: 'authenticator-rs-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.xz.md5sum'
asset_content_type: text/plain
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ clean :

debian-pkg : install
mkdir -p $(DESTDIR)/DEBIAN
cp data/deb/control $(DESTDIR)/DEBIAN/
cp data/debian/control $(DESTDIR)/DEBIAN/
echo "Version: $(RELEASE_VERSION)" >> $(DESTDIR)/DEBIAN/control
cp data/deb/postinst $(DESTDIR)/DEBIAN/
cp data/debian/postinst $(DESTDIR)/DEBIAN/
chmod 775 $(DESTDIR)/DEBIAN/postinst
dpkg-deb --build $(DESTDIR) authenticator-rs-$(RELEASE_VERSION)-x86-64.deb
dpkg-deb --build $(DESTDIR) authenticator-rs-$(RELEASE_VERSION)-x86_64.deb
md5sum authenticator-rs-$(RELEASE_VERSION)-x86_64.deb > authenticator-rs-$(RELEASE_VERSION)-x86_64.deb.md5sum

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ See [releases](https://github.com/grumlimited/authenticator-rs/releases).

## Installing

#### Debian

Download from the [release](https://github.com/grumlimited/authenticator-rs/releases) page.

#### Debian

dpkg -i authenticator-rs-x.x.x-x86-64.deb

#### Arch Linux

pacman -U authenticator-rs-x.x.x-1-x86_64.pkg.tar.xz

## Building

cargo build
Expand Down
30 changes: 30 additions & 0 deletions data/arch/authenticator-rs/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Maintainer: Romain Gallet <[email protected]>
_packager="Romain Gallet <[email protected]>"
pkgname=authenticator-rs
# pkgver=0.0.8 # set in CI
pkgrel=1
pkgdesc='MFA Authenticator. TOTP-MFA application written in Rust and GTK3.'
arch=('x86_64')
url="https://github.com/grumlimited/$pkgname/releases/download/$pkgver/$pkgname-$pkgver-$arch.deb"
license=('GPLv3')
groups=()
depends=('cairo' 'desktop-file-utils' 'gcc-libs' 'gdk-pixbuf2' 'glib2' 'gtk3' 'hicolor-icon-theme' 'pango' 'sqlite')
makedepends=()
checkdepends=()
optdepends=()
provides=()
replaces=()
backup=()
options=()
install=$pkgname.install
source=($url)
noextract=()

build() {
rm control.tar.xz
tar xvf data.tar.xz
}

package() {
cp -fr usr/ ${pkgdir}
}
16 changes: 16 additions & 0 deletions data/arch/authenticator-rs/authenticator-rs.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
post_install() {
gtk-update-icon-cache -q -t -f usr/share/icons/hicolor

chmod +x /usr/bin/authenticator-rs

update-desktop-database -q
}

post_upgrade() {
post_install
}

post_remove() {
gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
update-desktop-database -q
}
8 changes: 8 additions & 0 deletions data/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Package: authenticator-rs
Section: development
Priority: optional
Architecture: all
Depends: libgtk-3-0, libsqlite3-0, libcairo2, desktop-file-utils, libgdk-pixbuf2.0-0, libglib2.0-0, hicolor-icon-theme
Maintainer: rgallet_at_grumlimited.co.uk
Description: MFA Authenticator
Authenticator-rs is a TOTP-MFA application written in Rust and GTK3.
9 changes: 9 additions & 0 deletions data/debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

gtk-update-icon-cache -q -t -f usr/share/icons/hicolor

chmod +x /usr/bin/authenticator-rs

update-desktop-database -q

exit 0

0 comments on commit 633eed4

Please sign in to comment.