-
-
Notifications
You must be signed in to change notification settings - Fork 6
60 lines (46 loc) · 1.71 KB
/
update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Check update and push to AUR
on:
schedule:
- cron: '37 17 * * *'
repository_dispatch:
jobs:
update:
runs-on: ubuntu-latest
container:
image: archlinux
steps:
- name: Save ssh key
run: |
echo "${{ secrets.SSH_KEY }}" | install -Dm400 /dev/stdin ~/.ssh/id_ed25519
- name: Get time
id: time
run: echo "::set-output name=time::$(date +%F-%T)"
- name: Set up cache
uses: actions/cache@master
with:
path: /var/cache/pacman/pkg
key: pacman-cache-x86_64-${{ steps.time.outputs.time }}
restore-keys: pacman-cache-x86_64-
- name: Install packages
run: |
pacman -Syu --noconfirm
pacman -S --needed --noconfirm git jq pacman-contrib openssh
- uses: actions/checkout@v2
- name: Check update
run: |
set -x
current=$(grep -P '^pkgver' PKGBUILD | cut -d= -f2)
latest=$(curl https://api.github.com/repos/actions/runner/releases | jq -r '.[] | .tag_name' | grep -P 'v[0-9.]*' | head -n1 | cut -c 2-)
[ "$current" = "$latest" ] && exit
useradd makepkg
chown makepkg:root . -R
sed "/^pkgver/s/.*/pkgver=${latest}/" -i PKGBUILD
su makepkg -c "updpkgsums"
su makepkg -c "makepkg --printsrcinfo" > .SRCINFO
git config user.name ${{ secrets.GIT_COMMIT_NAME }}
git config user.email ${{ secrets.GIT_COMMIT_EMAIL }}
git add .
git commit -m "auto upgraded to ${latest}"
[ -n "${{ secrets.READ_ONLY }}" ] && git show && exit
git push origin master
git push ssh://[email protected]/github-actions-bin.git master