浏览代码

Build and release Arch AUR package

Tim Visée 6 年之前
父节点
当前提交
ab4ba3e0c4
共有 4 个文件被更改,包括 91 次插入2 次删除
  1. 46 0
      .gitlab-ci.yml
  2. 15 2
      README.md
  3. 29 0
      pkg/aur/PKGBUILD
  4. 1 0
      pkg/aur/aur.pub

+ 46 - 0
.gitlab-ci.yml

@@ -131,3 +131,49 @@ crate:
     - echo $CARGO_TOKEN | cargo login
     - echo "Publishing crate to crates.io..."
     - cargo publish --verbose --allow-dirty
+
+# AUR package release
+pkg-aur:
+  image: base/archlinux
+  stage: release
+  only:
+    - /^v(\d+\.)*\d+$/
+  before_script: []
+  script:
+    - cd ./pkg/aur
+
+      # Update version number in PKGBUILD
+    - VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-)
+    - echo "Determined binary version number 'v$VERSION', updating PKGBUILD..."
+    - sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i PKGBUILD
+
+      # Install dependencies
+    - echo "Installing required build packages..."
+    - pacman -Syu --noconfirm sudo base-devel binutils openssh rust cargo cmake git openssl
+
+      # Make AUR package
+    - echo "Making AUR package..."
+    - mkdir -p /.cargo
+    - chmod -R 777 /.cargo
+    - sudo -u nobody makepkg -c
+    - sudo -u nobody makepkg --printsrcinfo > .SRCINFO
+
+      # Publish: set up SSH key, clone AUR repo, commit update and push
+    - mkdir -p /root/.ssh
+    - cp ./aur.pub /root/.ssh/id_rsa.pub
+    - echo "$AUR_SSH_PRIVATE" > /root/.ssh/id_rsa
+    - echo "Host aur.archlinux.org" >> /root/.ssh/config
+    - echo "  IdentityFile /root/.ssh/aur" >> /root/.ssh/config
+    - echo "  User aur" >> /root/.ssh/config
+    - chmod 600 /root/.ssh/{id_rsa*,config}
+    - eval `ssh-agent -s`
+    - ssh-add /root/.ssh/id_rsa
+    - ssh-keyscan -H aur.archlinux.org >> /root/.ssh/known_hosts
+    - git config --global user.name "timvisee"
+    - git config --global user.email "timvisee@gmail.com"
+    - git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend
+    - cd aur-ffsend
+    - cp ../{PKGBUILD,.SRCINFO} ./
+    - git add PKGBUILD .SRCINFO
+    - git commit -m "Release v$VERSION"
+    - git push

+ 15 - 2
README.md

@@ -146,15 +146,27 @@ all available subcommands.
 Because `ffsend` is still in alpha, only limited installation options are
 available right now.  
 
-A set of pre-build binaries for Linux and macOS can be found as asset of the
+### Arch AUR package
+[» `ffsend` on `aur.archlinux.org`][aur-ffsend]
+
+```bash
+yaourt -S ffsend
+# or
+yay ffsend
+# or using any other AUR installer
+```
+
+#### Prebuilt binaries
+A set of prebuilt binaries for Linux and macOS can be found as asset of the
 [latest release][github-latest-release]. When downloading such release, mark
 the binary as executable using `chmod a+x ffsend`, and move it into `/usr/bin/`.
 
+#### Other
 A Windows binary and packaged versions for various Linux distributions is
 currently being worked on.
 
 It is recommended to build and install `ffsend` yourself using these fairly
-easy steps [here](#build).
+easy steps [below](#build).
 
 ## Build
 To build and install `ffsend` yourself, you meet the following requirements
@@ -394,3 +406,4 @@ Check out the [LICENSE](LICENSE) file for more information.
 [asciinema]: https://asciinema.org/
 [svg-term]: https://github.com/marionebl/svg-term-cli
 [github-latest-release]: https://github.com/timvisee/ffsend/releases/latest
+[aur-ffsend]: https://aur.archlinux.org/packages/ffsend/

+ 29 - 0
pkg/aur/PKGBUILD

@@ -0,0 +1,29 @@
+# Maintainer: Tim Visee <timvisee@gmail.com>
+
+pkgname=ffsend
+pkgver=0.0.0
+pkgrel=1
+pkgdesc="Easily and securely share files from the command line. A Firefox Send client."
+url="https://gitlab.com/timvisee/ffsend"
+license=('GPL3')
+source=("$pkgname-v$pkgver.tar.gz::$url/-/archive/v$pkgver/$pkgname-v$pkgver.tar.gz")
+sha256sums=('SKIP')
+arch=('x86_64' 'i686')
+depends=('ca-certificates')
+makedepends=('openssl>=1.0' 'rust' 'cargo' 'cmake')
+optdepends=('xclip: clipboard support')
+
+pkgver() {
+    cd "$pkgname-v$pkgver"
+    echo "$(grep '^version =' Cargo.toml|head -n1|cut -d\" -f2)"
+    #.$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)
+}
+
+build() {
+    cd "$pkgname-v$pkgver"
+    env CARGO_INCREMENTAL=0 cargo build --release
+}
+
+package() {
+    install -Dm755 "$srcdir/$pkgname-v$pkgver/target/release/$pkgname" "$pkgdir/usr/bin/$pkgname"
+}

+ 1 - 0
pkg/aur/aur.pub

@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHfiNi+rOCPKGLB6v9uuYR6GkN6Zd+CdaRbV82A26AUzs48ZG0xZGXHsoRuZY/yCUhcrS2u9xZ16fsAxnyf1QCF1hZVABUYtNhL1eEbSbLNiG9vIWJzbRjgegN/yyiG9ZVhFfNqXtPeapvuM3H44a2XeeFJcvTOfj/alkVjypi/DY/+XpC1IlX+CARC/e0zXHa3KZohn+CfBj8kWZWQEr7+EtKT59pslNxuJPcDUw7sKYLcBBz00BT0vv3lntyvZI1rRsD7AvItOwSZPp6or78Tgp8+O0HvFpjrlNipPEqDPpETIPcjTIVAlvlPFK1J0Rpzud38YdoWGfPiM77k7L7 timvisee@aur