Commit 909c7069ce
Unsigned
Layout: unified · split
.github/workflows/update-aur.yml +15 −24
| @@ -32,6 +32,11 @@ jobs: | ||
| 32 | 32 | echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT |
| 33 | 33 | echo "Extracted version: $VERSION" |
| 34 | 34 | |
| 35 | - name: Install dependencies | |
| 36 | run: | | |
| 37 | sudo apt-get update | |
| 38 | sudo apt-get install -y expect git sshpass | |
| 39 | ||
| 35 | 40 | - name: Set up SSH for AUR |
| 36 | 41 | run: | |
| 37 | 42 | mkdir -p ~/.ssh |
| @@ -49,6 +54,10 @@ jobs: | ||
| 49 | 54 | |
| 50 | 55 | # Start SSH agent and add key with passphrase |
| 51 | 56 | eval $(ssh-agent -s) |
| 57 | echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV | |
| 58 | echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV | |
| 59 | ||
| 60 | # Use expect to add the key with passphrase | |
| 52 | 61 | expect -c " |
| 53 | 62 | spawn ssh-add ~/.ssh/aur_rsa |
| 54 | 63 | expect \"Enter passphrase\" |
| @@ -56,20 +65,9 @@ jobs: | ||
| 56 | 65 | expect eof |
| 57 | 66 | " |
| 58 | 67 | |
| 59 | - name: Install dependencies | |
| 60 | run: | | |
| 61 | sudo apt-get update | |
| 62 | sudo apt-get install -y expect git | |
| 63 | ||
| 64 | 68 | - name: Clone AUR repository |
| 65 | 69 | run: | |
| 66 | eval $(ssh-agent -s) | |
| 67 | expect -c " | |
| 68 | spawn ssh-add ~/.ssh/aur_rsa | |
| 69 | expect \"Enter passphrase\" | |
| 70 | send \"sex\r\" | |
| 71 | expect eof | |
| 72 | " | |
| 70 | # The SSH agent should still be running with the key loaded | |
| 73 | 71 | git clone ssh://aur@aur.archlinux.org/curd.git aur-curd |
| 74 | 72 | |
| 75 | 73 | - name: Update PKGBUILD |
| @@ -103,15 +101,6 @@ jobs: | ||
| 103 | 101 | - name: Commit and push to AUR |
| 104 | 102 | working-directory: aur-curd |
| 105 | 103 | run: | |
| 106 | # Start SSH agent for the commit/push | |
| 107 | eval $(ssh-agent -s) | |
| 108 | expect -c " | |
| 109 | spawn ssh-add ~/.ssh/aur_rsa | |
| 110 | expect \"Enter passphrase\" | |
| 111 | send \"sex\r\" | |
| 112 | expect eof | |
| 113 | " 2>/dev/null | |
| 114 | ||
| 115 | 104 | # Check if there are changes to commit |
| 116 | 105 | if git diff --quiet && git diff --cached --quiet; then |
| 117 | 106 | echo "No changes to commit" |
| @@ -122,12 +111,14 @@ jobs: | ||
| 122 | 111 | git add PKGBUILD .SRCINFO |
| 123 | 112 | git commit -m "Update to version ${{ steps.version.outputs.version }}" |
| 124 | 113 | |
| 125 | # Push changes | |
| 114 | # Push changes (SSH agent should still have the key loaded) | |
| 126 | 115 | git push origin master |
| 127 | 116 | |
| 128 | 117 | - name: Cleanup |
| 129 | 118 | if: always() |
| 130 | 119 | run: | |
| 131 | # Clean up SSH keys | |
| 120 | # Clean up SSH keys and kill SSH agent | |
| 132 | 121 | rm -f ~/.ssh/aur_rsa |
| 133 | ssh-agent -k 2>/dev/null || true | |
| 122 | if [ -n "$SSH_AGENT_PID" ]; then | |
| 123 | kill $SSH_AGENT_PID 2>/dev/null || true | |
| 124 | fi | |