@@ -39,133 +39,7 @@ jobs:
3939 fi
4040
4141 # Check for relevant file changes in the last commit
42- if git diff-tree --no-commit-id --name-only -r HEAD | grep -E '^src/|^Cargo\.(toml|lock)$|^README\.md$|^LICENSE
43-
44- - name : Setup SSH for AUR
45- if : steps.should_run.outputs.run == 'true'
46- run : |
47- mkdir -p /root/.ssh
48- echo "${{ secrets.AUR_SSH_KEY }}" > /root/.ssh/aur
49- chmod 600 /root/.ssh/aur
50- chmod 700 /root/.ssh
51- ssh-keyscan aur.archlinux.org >> /root/.ssh/known_hosts
52-
53- - name : Test AUR connection
54- if : steps.should_run.outputs.run == 'true'
55- run : |
56- if ssh -i /root/.ssh/aur -T aur@aur.archlinux.org 2>&1 | grep -q "Welcome to AUR"; then
57- echo "AUR connection successful"
58- else
59- echo "AUR connection failed"
60- exit 1
61- fi
62-
63- - name : Clone AUR git package
64- if : steps.should_run.outputs.run == 'true'
65- run : |
66- export GIT_SSH_COMMAND="ssh -i /root/.ssh/aur -o StrictHostKeyChecking=no"
67- git clone ssh://aur@aur.archlinux.org/sshctl-git.git aur-repo
68-
69- - name : Calculate development version
70- if : steps.should_run.outputs.run == 'true'
71- id : version
72- run : |
73- # Extract version from Cargo.toml
74- CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
75-
76- # Get short commit hash (7 characters)
77- SHORT_HASH=$(git rev-parse --short=7 HEAD)
78-
79- # Create development version: cargo_version-short_hash
80- DEV_VERSION="${CARGO_VERSION}-${SHORT_HASH}"
81-
82- echo "dev_version=${DEV_VERSION}" >> $GITHUB_OUTPUT
83- echo "Development version: ${DEV_VERSION}"
84- echo "Cargo version: ${CARGO_VERSION}, Commit hash: ${SHORT_HASH}"
85-
86- - name : Create development PKGBUILD
87- if : steps.should_run.outputs.run == 'true'
88- run : |
89- cd aur-repo
90- cat > PKGBUILD << 'PKGBUILD_EOF'
91- # Maintainer: ${{ secrets.AUR_MAINTAINER_NAME }} <${{ secrets.AUR_MAINTAINER_EMAIL }}>
92- pkgname=sshctl-git
93- pkgver=${{ steps.version.outputs.dev_version }}
94- pkgrel=1
95- pkgdesc="SSH connection manager CLI tool (development version)"
96- arch=('x86_64')
97- url="https://github.com/${{ github.repository }}"
98- license=('MIT')
99- depends=('glibc')
100- makedepends=('git' 'rust')
101- provides=('sshctl')
102- conflicts=('sshctl')
103- source=("git+https://github.com/${{ github.repository }}.git")
104- sha256sums=('SKIP')
105-
106- pkgver() {
107- cd "${srcdir}/sshctl"
108- local cargo_ver=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
109- local short_hash=$(git rev-parse --short=7 HEAD)
110- printf "%s-%s" "${cargo_ver}" "${short_hash}"
111- }
112-
113- build() {
114- cd "${srcdir}/sshctl"
115- cargo build --release
116- }
117-
118- package() {
119- cd "${srcdir}/sshctl"
120- install -Dm755 "target/release/sshctl" "${pkgdir}/usr/bin/sshctl"
121-
122- if [ -f README.md ]; then
123- install -Dm644 README.md "${pkgdir}/usr/share/doc/sshctl/README.md"
124- fi
125-
126- if [ -f LICENSE ]; then
127- install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/sshctl/LICENSE"
128- fi
129- }
130- PKGBUILD_EOF
131-
132- - name : Generate .SRCINFO for development package
133- if : steps.should_run.outputs.run == 'true'
134- run : |
135- cd aur-repo
136-
137- # Create non-root user for makepkg
138- useradd -m -s /bin/bash builder
139-
140- # Copy PKGBUILD to builder's home and generate .SRCINFO there
141- cp PKGBUILD /home/builder/
142- chown builder:builder /home/builder/PKGBUILD
143-
144- # Generate .SRCINFO as non-root user
145- su builder -c "cd /home/builder && makepkg --printsrcinfo" > .SRCINFO
146-
147- # Ensure root owns the .SRCINFO in the repo
148- chown root:root .SRCINFO
149-
150- - name : Commit and push development version to AUR
151- if : steps.should_run.outputs.run == 'true'
152- run : |
153- cd aur-repo
154- export GIT_SSH_COMMAND="ssh -i /root/.ssh/aur -o StrictHostKeyChecking=no"
155-
156- git config user.name "${{ secrets.AUR_MAINTAINER_NAME }}"
157- git config user.email "${{ secrets.AUR_MAINTAINER_EMAIL }}"
158-
159- git add PKGBUILD .SRCINFO
160-
161- if git diff --cached --quiet; then
162- echo "No changes to commit"
163- else
164- git commit -m "Update development version to ${{ steps.version.outputs.dev_version }}"
165- git push origin master
166- echo "AUR development package updated successfully!"
167- fi
168- ; then
42+ if git diff-tree --no-commit-id --name-only -r HEAD | grep -E '^src/|^Cargo\.(toml|lock)$|^README\.md$|^LICENSE$'; then
16943 echo "run=true" >> $GITHUB_OUTPUT
17044 echo "Relevant files changed"
17145 else
21993 if : steps.should_run.outputs.run == 'true'
22094 run : |
22195 cd aur-repo
222- cat > PKGBUILD << 'EOF '
96+ cat > PKGBUILD << 'PKGBUILD_EOF '
22397 # Maintainer: ${{ secrets.AUR_MAINTAINER_NAME }} <${{ secrets.AUR_MAINTAINER_EMAIL }}>
22498 pkgname=sshctl-git
22599 pkgver=${{ steps.version.outputs.dev_version }}
@@ -237,11 +111,8 @@ jobs:
237111
238112 pkgver() {
239113 cd "${srcdir}/sshctl"
240- # Extract version from Cargo.toml
241114 local cargo_ver=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
242- # Get short commit hash (7 characters)
243115 local short_hash=$(git rev-parse --short=7 HEAD)
244- # Return version format: cargo_version-short_hash
245116 printf "%s-%s" "${cargo_ver}" "${short_hash}"
246117 }
247118
@@ -254,17 +125,15 @@ jobs:
254125 cd "${srcdir}/sshctl"
255126 install -Dm755 "target/release/sshctl" "${pkgdir}/usr/bin/sshctl"
256127
257- # Documentation
258128 if [ -f README.md ]; then
259129 install -Dm644 README.md "${pkgdir}/usr/share/doc/sshctl/README.md"
260130 fi
261131
262- # License
263132 if [ -f LICENSE ]; then
264133 install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/sshctl/LICENSE"
265134 fi
266135 }
267- EOF
136+ PKGBUILD_EOF
268137
269138 - name : Generate .SRCINFO for development package
270139 if : steps.should_run.outputs.run == 'true'
0 commit comments