-
Notifications
You must be signed in to change notification settings - Fork 4
128 lines (116 loc) · 3.89 KB
/
aur.yml
File metadata and controls
128 lines (116 loc) · 3.89 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: AUR Publish
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish (e.g. v2.1.1)'
required: true
permissions:
contents: read
jobs:
publish:
if: github.server_url == 'https://github.com'
runs-on: ubuntu-latest
steps:
- name: Resolve version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
else
TAG="${GITHUB_REF_NAME}"
fi
PKGVER="${TAG#v}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "pkgver=$PKGVER" >> "$GITHUB_OUTPUT"
- name: Wait for tarball & compute sha256
id: sha
run: |
URL="https://github.com/madLinux7/dssh/archive/${{ steps.version.outputs.tag }}.tar.gz"
for i in 1 2 3 4 5; do
if curl -fsSL "$URL" -o src.tar.gz; then
break
fi
echo "Tarball not ready, retry $i/5..."
sleep 10
done
SHA=$(sha256sum src.tar.gz | awk '{print $1}')
echo "sha256=$SHA" >> "$GITHUB_OUTPUT"
- name: Setup SSH for AUR
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
printf '%s\n' "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/aur
chmod 600 ~/.ssh/aur
ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
cat > ~/.ssh/config <<EOF
Host aur.archlinux.org
User aur
IdentityFile ~/.ssh/aur
IdentitiesOnly yes
StrictHostKeyChecking yes
EOF
chmod 600 ~/.ssh/config
- name: Clone AUR repo
run: git clone ssh://aur@aur.archlinux.org/dssh.git aur-repo
- name: Render PKGBUILD & .SRCINFO
env:
PKGVER: ${{ steps.version.outputs.pkgver }}
SHA256: ${{ steps.sha.outputs.sha256 }}
run: |
cat > aur-repo/PKGBUILD <<EOF
# Maintainer: Linus Grolmes <linus@grolmes.de>
pkgname=dssh
pkgver=${PKGVER}
pkgrel=1
pkgdesc="The only SSH connection manager you'll ever need. CLI & TUI."
arch=('x86_64' 'aarch64')
url="https://github.com/madLinux7/dssh"
license=('MIT')
makedepends=('go')
depends=('openssh')
source=("\$pkgname-\$pkgver.tar.gz::https://github.com/madLinux7/dssh/archive/v\$pkgver.tar.gz")
sha256sums=('${SHA256}')
build() {
cd "\$pkgname-\$pkgver"
export CGO_ENABLED=0
go build -ldflags="-s -w -X main.version=v\$pkgver" -o dssh ./cmd/dssh/
}
package() {
cd "\$pkgname-\$pkgver"
install -Dm755 dssh "\$pkgdir/usr/bin/dssh"
install -Dm644 LICENSE "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE"
}
EOF
cat > aur-repo/.SRCINFO <<EOF
pkgbase = dssh
pkgdesc = The only SSH connection manager you'll ever need. CLI & TUI.
pkgver = ${PKGVER}
pkgrel = 1
url = https://github.com/madLinux7/dssh
arch = x86_64
arch = aarch64
license = MIT
makedepends = go
depends = openssh
source = dssh-${PKGVER}.tar.gz::https://github.com/madLinux7/dssh/archive/v${PKGVER}.tar.gz
sha256sums = ${SHA256}
pkgname = dssh
EOF
- name: Commit & push
working-directory: aur-repo
env:
TAG: ${{ steps.version.outputs.tag }}
run: |
git config user.name "Linus Grolmes"
git config user.email "linus@grolmes.de"
git add PKGBUILD .SRCINFO
if git diff --cached --quiet; then
echo "No changes to publish"
exit 0
fi
git commit -m "[ci] Update to ${TAG}"
git push