Commit 1cf85f3f5d
Unsigned
Layout: unified · split
.github/workflows/update-aur.yml added +133
| @@ -0,0 +1,133 @@ | ||
| 1 | name: Update AUR Package | |
| 2 | ||
| 3 | on: | |
| 4 | release: | |
| 5 | types: [published] | |
| 6 | workflow_dispatch: | |
| 7 | inputs: | |
| 8 | tag_name: | |
| 9 | description: 'Release tag name (e.g., v1.2.3)' | |
| 10 | required: true | |
| 11 | type: string | |
| 12 | ||
| 13 | jobs: | |
| 14 | update-aur: | |
| 15 | runs-on: ubuntu-latest | |
| 16 | if: github.repository == 'Wraient/curd' | |
| 17 | ||
| 18 | steps: | |
| 19 | - name: Checkout main repository | |
| 20 | uses: actions/checkout@v4 | |
| 21 | ||
| 22 | - name: Extract version from tag | |
| 23 | id: version | |
| 24 | run: | | |
| 25 | if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| 26 | TAG_NAME="${{ github.event.inputs.tag_name }}" | |
| 27 | else | |
| 28 | TAG_NAME="${{ github.event.release.tag_name }}" | |
| 29 | fi | |
| 30 | VERSION=$(echo "$TAG_NAME" | sed 's/^v//') | |
| 31 | echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| 32 | echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
| 33 | echo "Extracted version: $VERSION" | |
| 34 | ||
| 35 | - name: Set up SSH for AUR | |
| 36 | run: | | |
| 37 | mkdir -p ~/.ssh | |
| 38 | echo "${{ secrets.AUR_SSH_KEY }}" > ~/.ssh/aur_rsa | |
| 39 | chmod 600 ~/.ssh/aur_rsa | |
| 40 | ||
| 41 | # Create SSH config for AUR | |
| 42 | cat > ~/.ssh/config << EOF | |
| 43 | Host aur.archlinux.org | |
| 44 | HostName aur.archlinux.org | |
| 45 | User aur | |
| 46 | IdentityFile ~/.ssh/aur_rsa | |
| 47 | StrictHostKeyChecking no | |
| 48 | EOF | |
| 49 | ||
| 50 | # Start SSH agent and add key with passphrase | |
| 51 | eval $(ssh-agent -s) | |
| 52 | expect -c " | |
| 53 | spawn ssh-add ~/.ssh/aur_rsa | |
| 54 | expect \"Enter passphrase\" | |
| 55 | send \"sex\r\" | |
| 56 | expect eof | |
| 57 | " | |
| 58 | ||
| 59 | - name: Install dependencies | |
| 60 | run: | | |
| 61 | sudo apt-get update | |
| 62 | sudo apt-get install -y expect git | |
| 63 | ||
| 64 | - name: Clone AUR repository | |
| 65 | 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 | " | |
| 73 | git clone ssh://aur@aur.archlinux.org/curd.git aur-curd | |
| 74 | ||
| 75 | - name: Update PKGBUILD | |
| 76 | working-directory: aur-curd | |
| 77 | run: | | |
| 78 | # Configure git | |
| 79 | git config user.name "Wraient" | |
| 80 | git config user.email "rushikeshwastaken@gmail.com" | |
| 81 | ||
| 82 | # Update pkgver in PKGBUILD | |
| 83 | sed -i "s/^pkgver=.*/pkgver=${{ steps.version.outputs.version }}/" PKGBUILD | |
| 84 | ||
| 85 | # Reset pkgrel to 1 for new version | |
| 86 | sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD | |
| 87 | ||
| 88 | # Update .SRCINFO | |
| 89 | makepkg --printsrcinfo > .SRCINFO | |
| 90 | ||
| 91 | echo "Updated PKGBUILD:" | |
| 92 | cat PKGBUILD | |
| 93 | ||
| 94 | - name: Verify release exists | |
| 95 | run: | | |
| 96 | # Check if the release and binary exist | |
| 97 | curl -f -L -I "https://github.com/Wraient/curd/releases/download/${{ steps.version.outputs.tag_name }}/curd-linux-x86_64" || { | |
| 98 | echo "Error: Release binary not found!" | |
| 99 | echo "Expected URL: https://github.com/Wraient/curd/releases/download/${{ steps.version.outputs.tag_name }}/curd-linux-x86_64" | |
| 100 | exit 1 | |
| 101 | } | |
| 102 | ||
| 103 | - name: Commit and push to AUR | |
| 104 | working-directory: aur-curd | |
| 105 | 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 | # Check if there are changes to commit | |
| 116 | if git diff --quiet && git diff --cached --quiet; then | |
| 117 | echo "No changes to commit" | |
| 118 | exit 0 | |
| 119 | fi | |
| 120 | ||
| 121 | # Add and commit changes | |
| 122 | git add PKGBUILD .SRCINFO | |
| 123 | git commit -m "Update to version ${{ steps.version.outputs.version }}" | |
| 124 | ||
| 125 | # Push changes | |
| 126 | git push origin master | |
| 127 | ||
| 128 | - name: Cleanup | |
| 129 | if: always() | |
| 130 | run: | | |
| 131 | # Clean up SSH keys | |
| 132 | rm -f ~/.ssh/aur_rsa | |
| 133 | ssh-agent -k 2>/dev/null || true | |
PKGBUILD +6 −15
| @@ -1,26 +1,17 @@ | ||
| 1 | 1 | # Maintainer: Wraient <rushikeshwastaken@gmail.com> |
| 2 | 2 | pkgname='curd' |
| 3 | pkgver=1.0.3 | |
| 4 | pkgrel=2 | |
| 3 | pkgver=1.1.4 | |
| 4 | pkgrel=1 | |
| 5 | 5 | pkgdesc="Watch anime in CLI with AniList Tracking, Discord RPC, Intro/Outro/Filler/Recap Skipping, etc." |
| 6 | 6 | arch=('x86_64') |
| 7 | 7 | url="https://github.com/Wraient/curd" |
| 8 | 8 | license=('GPL') |
| 9 | 9 | depends=('mpv' 'rofi' 'ueberzugpp') |
| 10 | source=("$pkgname::https://github.com/Wraient/curd/releases/latest/download/curd") | |
| 10 | provides=('curd') | |
| 11 | conflicts=('curd') | |
| 12 | source=("https://github.com/Wraient/curd/releases/download/v${pkgver}/curd-linux-x86_64") | |
| 11 | 13 | sha256sums=('SKIP') |
| 12 | 14 | |
| 13 | 15 | package() { |
| 14 | # Install the precompiled binary into /usr/bin | |
| 15 | install -Dm755 "$srcdir/curd" "$pkgdir/usr/bin/curd" | |
| 16 | } | |
| 17 | ||
| 18 | pkgver() { | |
| 19 | local ver | |
| 20 | ver=$(curl -s --fail "https://api.github.com/repos/Wraient/curd/releases/latest" | jq -r '.tag_name' | sed 's/^v//') | |
| 21 | if [ -n "$ver" ]; then | |
| 22 | echo "$ver" | |
| 23 | else | |
| 24 | echo "$pkgver" | |
| 25 | fi | |
| 16 | install -Dm755 "$srcdir/curd-linux-x86_64" "$pkgdir/usr/bin/curd" | |
| 26 | 17 | } |