-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (62 loc) · 2.6 KB
/
main.yml
File metadata and controls
82 lines (62 loc) · 2.6 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: AUR package update Workflow
on:
push:
branches:
- master
env:
AUR_PKG_NAME: "python-box"
jobs:
update:
name: "Update repository"
runs-on: ubuntu-latest
container:
image: archlinux/archlinux:latest
steps:
- name: Store the SSH key
run: |
echo "${{ secrets.MY_SSH_KEY }}" | install -Dm600 /dev/stdin /root/.ssh/id_rsa
- name: Get time for cache
id: cache_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.cache_time.outputs.time }}
restore-keys: pacman-cache-x86_64-
- name: Install dependencies
run: |
pacman -Syu --needed --noconfirm && \
pacman -S --needed --noconfirm git binutils pacman-contrib openssh rsync
- name: Checkout Repository
uses: actions/checkout@v3
- name: Update if necessary
env:
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
run: |
aurRepoDir=/tmp/${AUR_PKG_NAME}
githubRepoDir="${PWD}"
buildDir="/tmp/build"
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git config --global --add safe.directory ${aurRepoDir}
git config --global --add safe.directory ${githubRepoDir}
git config --global user.name ${{ secrets.MY_GIT_NAME }}
git config --global user.email ${{ secrets.MY_GIT_EMAIL }}
git clone ssh://aur@aur.archlinux.org/${AUR_PKG_NAME}.git ${aurRepoDir}
aurCommitMessage="$(git log -1 --pretty=format:%B)"
rsync --progress --delete -r --exclude={'*.gz','*.xz','.github','pkg','src','.git'} ${githubRepoDir}/ ${buildDir}/
cd ${buildDir}
useradd makepkg
chown makepkg:root . -R
su makepkg -c "updpkgsums"
su makepkg -c "makepkg --printsrcinfo" > .SRCINFO
rsync --progress --delete -r --exclude={'*.gz','*.xz','*.tar','.github','pkg','src','.git'} ${buildDir}/ ${githubRepoDir}/
rsync --progress --delete -r --exclude={'*.gz','*.xz','*.tar','.github','pkg','src','.git'} ${buildDir}/ ${aurRepoDir}/
cd ${aurRepoDir}
git add .
git diff --quiet --exit-code --cached || git commit -m "${aurCommitMessage}"
git push origin master
cd ${githubRepoDir}
git add .
git diff --quiet --exit-code --cached || git commit -m "Update .SRCINFO"
git push origin master