diff options
-rw-r--r-- | .gitlab-ci.yml | 42 | ||||
-rwxr-xr-x | post-update.sh | 31 | ||||
-rw-r--r-- | renovate.json | 27 |
3 files changed, 100 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000000..fe29e762f756 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,42 @@ +build: + stage: build + image: + name: countstarlight/makepkg:latest + entrypoint: [""] + before_script: + - yay -Syu --noconfirm + script: + - | + depends=() + makedepends=() + checkdepends=() + . ./PKGBUILD + deps=( "${depends[@]}" "${makedepends[@]}" "${checkdepends[@]}" ) + (pacman --deptest "${deps[@]}" || true) | xargs yay -Sy --noconfirm + - makepkg -f + artifacts: + untracked: false + expire_in: 5 days + paths: + - '*.pkg.tar.zst' + +deploy: + stage: deploy + image: bitnami/git:latest + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + variables: + GIT_DEPTH: "0" + before_script: + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + + - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - + + script: + - git remote add aur ssh://aur@aur.archlinux.org/jdtls.git + - git push aur origin/master:master diff --git a/post-update.sh b/post-update.sh new file mode 100755 index 000000000000..ed2a36a7348b --- /dev/null +++ b/post-update.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -exuo pipefail + +uid="$(id -u)" + +# Move pkgrel back to 1 after a version bump +sed -i 's/pkgrel=.*/pkgrel=1/' ./PKGBUILD + +# Update download URLs and checksums +new_version="$(grep 'pkgver=' PKGBUILD | cut -d = -f 2)" +filename="$(curl --fail "https://download.eclipse.org/jdtls/milestones/${new_version}/latest.txt" | head -n 1)" +sha256="$(curl --fail "https://download.eclipse.org/jdtls/milestones/${new_version}/${filename}.sha256")" + +sed -i "s%source=(\".*\"%source=(\"https://download.eclipse.org/jdtls/milestones/${new_version}/${filename}\"%" ./PKGBUILD +sed -i "s%sha256sums=('.*'%sha256sums=('${sha256}'%" ./PKGBUILD + +# Update the .SRCINFO file to match the new version. The easiest and most +# consistent way to do this is by using the archlinux-provided tools for this. +# Because renovate doesn't run in an arch container, use docker to spin up a +# temporary container for this purpose. makepkg in this container cannot be +# run as root. Therefore, create a temporary user for this. This used need to +# use the UID of the host's user to avoid file access problems when using bind +# mounts in docker. +docker run --rm -v "$(pwd):/pkg" archlinux:latest bash -c " +set -exuo pipefail +pacman -Syu --noconfirm binutils +useradd -u ${uid} builder +cd /pkg +su builder -c 'makepkg --printsrcinfo > .SRCINFO' +" diff --git a/renovate.json b/renovate.json new file mode 100644 index 000000000000..1bfb3e4b0888 --- /dev/null +++ b/renovate.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + + "extends": ["config:base"], + + "assignees": ["languitar"], + "reviewers": ["languitar"], + + "postUpgradeTasks": { + "commands": ["./post-update.sh"], + "fileFilters": ["PKGBUILD", ".SRCINFO"], + "executionMode": "branch" + }, + + "regexManagers": [ + { + "fileMatch": ["^PKGBUILD$"], + "matchStrings": [ + "pkgver=(?<currentValue>.*?)\n" + ], + "matchStringsStrategy": "combination", + "depNameTemplate": "eclipse/eclipse.jdt.ls", + "datasourceTemplate": "github-releases", + "extractVersionTemplate": "^v(?<version>.*)$" + } + ] +} |