Browse Source

Update AUR package release pipeline: proper names, proper URLs, sha sums

timvisee 6 years ago
parent
commit
8872f375ca
3 changed files with 63 additions and 28 deletions
  1. 51 17
      .gitlab-ci.yml
  2. 7 5
      pkg/aur/ffsend-bin/PKGBUILD
  3. 5 6
      pkg/aur/ffsend/PKGBUILD

+ 51 - 17
.gitlab-ci.yml

@@ -263,31 +263,55 @@ package-aur:
   script:
     - cd ./pkg/aur
 
-    # Update version number in PKGBUILD
+    # Determine the version number we're releasing for
     - VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-)
-    - echo "Determined binary version number 'v$VERSION', updating PKGBUILDs..."
-    - sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i bin/PKGBUILD
-    - sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i git/PKGBUILD
+    - echo "Determined binary version number 'v$VERSION'"
+
+    # Determine remote URLs and SHA checksums
+    - echo "Determining SHA checksums for remote files..."
+    - URL_BIN=https://github.com/timvisee/ffsend/releases/download/v$VERSION/ffsend-v$VERSION-linux-x64-static
+    - URL_SOURCE=https://gitlab.com/timvisee/ffsend/-/archive/v$VERSION/ffsend-v$VERSION.tar.gz
+    - 'echo "Selected binary URL: $URL_BIN"'
+    - 'echo "Selected source URL: $URL_SOURCE"'
+    - echo "Determining sha256sum for remote binary..."
+    - 'SHA_BIN=$(curl -sSL "$URL_BIN" | sha256sum | cut -d" " -f1)'
+    - 'echo "Got sha256sum: $SHA_BIN"'
+    - echo "Determining sha256sum for remote source..."
+    - 'SHA_SOURCE=$(curl -sSL "$URL_SOURCE" | sha256sum | cut -d" " -f1)'
+    - 'echo "Got sha256sum: $SHA_SOURCE"'
+
+    # Update PKGBUILD parameters: version, source URL and SHA sum
+    - echo "Updating PKGBUILDS with release information..."
+    - sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i ffsend/PKGBUILD
+    - sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i ffsend-bin/PKGBUILD
+    - sed "s/^source=(\"\(.*\)::.*\").*\$/source=('\1::$(echo $URL_SOURCE | sed 's/\//\\\//g')')/" -i ffsend/PKGBUILD
+    - sed "s/^source=(\"\(.*\)::.*\").*\$/source=('\1::$(echo $URL_BIN | sed 's/\//\\\//g')')/" -i ffsend-bin/PKGBUILD
+    - sed "s/^sha256sums=.*\$/sha256sums=('$SHA_SOURCE')/" -i ffsend/PKGBUILD
+    - sed "s/^sha256sums=.*\$/sha256sums=('$SHA_BIN')/" -i ffsend-bin/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
-    - cd bin/
+    - cd ffsend-bin/
     - echo "Making binary package..."
     - sudo -u nobody makepkg -c
     - sudo -u nobody makepkg --printsrcinfo > .SRCINFO
-    - cd ../git
-    - echo "Making git source package..."
+    - cd ../ffsend
+    - echo "Making main source package..."
     - sudo -u nobody makepkg -c
     - sudo -u nobody makepkg --printsrcinfo > .SRCINFO
+    # # TODO: only do this if the file has changed!
+    # - cd ../ffsend-git
+    # - echo "Making git source package..."
+    # - sudo -u nobody makepkg -c
+    # - sudo -u nobody makepkg --printsrcinfo > .SRCINFO
     - cd ..
 
-      # Set up SSH for publishing
+    # Set up SSH for publishing
     - mkdir -p /root/.ssh
     - cp ./aur.pub /root/.ssh/id_rsa.pub
     - echo "$AUR_SSH_PRIVATE" > /root/.ssh/id_rsa
@@ -301,22 +325,32 @@ package-aur:
     - git config --global user.name "timvisee"
     - git config --global user.email "tim@visee.me"
 
-      # Publish binary package: clone AUR repo, commit update and push
-    - git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend-bin
-    - cd aur-ffsend-bin
-    - cp ../bin/{PKGBUILD,.SRCINFO} ./
+    # Publish main package: clone AUR repo, commit update and push
+    - git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend
+    - cd aur-ffsend
+    - cp ../ffsend/{PKGBUILD,.SRCINFO} ./
     - git add PKGBUILD .SRCINFO
     - git commit -m "Release v$VERSION"
     - git push
     - cd ..
 
-      # Publish git package: clone AUR repo, commit update and push
-    - git clone ssh://aur@aur.archlinux.org/ffsend-git.git aur-ffsend-git
-    - cd aur-ffsend-git
-    - cp ../git/{PKGBUILD,.SRCINFO} ./
+    # Publish binary package: clone AUR repo, commit update and push
+    - git clone ssh://aur@aur.archlinux.org/ffsend-bin.git aur-ffsend-bin
+    - cd aur-ffsend-bin
+    - cp ../ffsend-bin/{PKGBUILD,.SRCINFO} ./
     - git add PKGBUILD .SRCINFO
     - git commit -m "Release v$VERSION"
     - git push
     - cd ..
 
+    # # Publish git package: clone AUR repo, commit update and push
+    # # TODO: only push here if things have changed!
+    # - git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend-git
+    # - cd aur-ffsend-git
+    # - cp ../ffsend-git/{PKGBUILD,.SRCINFO} ./
+    # - git add PKGBUILD .SRCINFO
+    # - git commit -m "Release v$VERSION"
+    # - git push
+    # - cd ..
+
 # TODO: add job to test ffsend{-git} AUR packages

+ 7 - 5
pkg/aur/bin/PKGBUILD → pkg/aur/ffsend-bin/PKGBUILD

@@ -1,15 +1,17 @@
 # Maintainer: Tim Visee <tim@visee.me>
+# Contributor: Ariel AxionL <i at axionl dot me>
 
-pkgname=ffsend
-pkgver=0.0.0
+pkgname=ffsend-bin
+pkgver=0.0.0 # automatically set in CI, see: /.gitlab-ci.yml
 pkgrel=1
 pkgdesc="Easily and securely share files from the command line. A Firefox Send client."
 url="https://gitlab.com/timvisee/ffsend"
 license=('GPL3')
-conflicts=('ffsend-git')
-source=("ffsend::https://github.com/timvisee/ffsend/releases/download/v$pkgver/ffsend-v$pkgver-linux-x64-static")
-sha256sums=('SKIP')
+source=("ffsend::https://github.com/timvisee/ffsend/releases/download/v$pkgver/ffsend-v$pkgver-linux-x64-static") # automatically set in CI, see: /.gitlab-ci.yml
+sha256sums=('SKIP') # automatically set in CI, see: /.gitlab-ci.yml
 arch=('x86_64')
+provides=('ffsend')
+conflicts=('ffsend')
 depends=('ca-certificates')
 optdepends=('xclip: clipboard support')
 

+ 5 - 6
pkg/aur/git/PKGBUILD → pkg/aur/ffsend/PKGBUILD

@@ -1,16 +1,15 @@
 # Maintainer: Tim Visee <tim@visee.me>
 
-pkgname=ffsend-git
-pkgver=0.0.0
+pkgname=ffsend
+pkgver=0.0.0 # automatically set in CI, see: /.gitlab-ci.yml
 pkgrel=1
 pkgdesc="Easily and securely share files from the command line. A Firefox Send client."
 url="https://gitlab.com/timvisee/ffsend"
 license=('GPL3')
-provides=('ffsend')
-conflicts=('ffsend')
-source=("ffsend-v$pkgver.tar.gz::$url/-/archive/v$pkgver/ffsend-v$pkgver.tar.gz")
-sha256sums=('SKIP')
+source=("ffsend-v$pkgver.tar.gz::$url/-/archive/v$pkgver/ffsend-v$pkgver.tar.gz") # automatically set in CI, see: /.gitlab-ci.yml
+sha256sums=('SKIP') # automatically set in CI, see: /.gitlab-ci.yml
 arch=('x86_64' 'i686')
+provides=('ffsend')
 depends=('ca-certificates')
 makedepends=('openssl>=1.0' 'rust>=1.32' 'cargo' 'cmake')
 optdepends=('xclip: clipboard support')