v1.2.3 #24
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update AUR Package | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| update-aur: | |
| runs-on: ubuntu-latest | |
| container: archlinux/archlinux:latest | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| pacman -Sy --noconfirm git curl openssh | |
| - name: Checkout main repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Matars/gitfetch | |
| path: gitfetch | |
| - name: Get version from pyproject.toml | |
| id: get_version | |
| run: | | |
| VERSION=$(grep '^version =' gitfetch/pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Download release tarball | |
| run: | | |
| curl -L -o release.tar.gz https://github.com/Matars/gitfetch/archive/refs/tags/v${{ steps.get_version.outputs.version }}.tar.gz | |
| - name: Calculate SHA256 | |
| id: sha256 | |
| run: | | |
| SHA256=$(shasum -a 256 release.tar.gz | cut -d' ' -f1) | |
| echo "sha256=$SHA256" >> $GITHUB_OUTPUT | |
| - name: Setup SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.AUR_TOKEN }}" > ~/.ssh/aur_key | |
| chmod 600 ~/.ssh/aur_key | |
| ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts | |
| - name: Clone AUR repo | |
| run: | | |
| GIT_SSH_COMMAND="ssh -i ~/.ssh/aur_key -o UserKnownHostsFile=~/.ssh/known_hosts" git clone ssh://[email protected]/gitfetch-python.git aur-repo | |
| cd aur-repo | |
| git config user.name "GitHub Actions" | |
| git config user.email "[email protected]" | |
| - name: Update PKGBUILD | |
| run: | | |
| cd aur-repo | |
| sed -i 's/pkgver=.*/pkgver=${{ steps.get_version.outputs.version }}/' PKGBUILD | |
| sed -i 's|source=.*|source=("$pkgname-$pkgver.tar.gz::https://github.com/Matars/gitfetch/archive/refs/tags/v$pkgver.tar.gz")|' PKGBUILD | |
| sed -i "s/sha256sums=.*/sha256sums=('${{ steps.sha256.outputs.sha256 }}')/" PKGBUILD | |
| # Update dependencies | |
| sed -i 's/depends=.*/depends=("python-requests" "python-readchar")/' PKGBUILD | |
| - name: Regenerate .SRCINFO | |
| run: | | |
| cd aur-repo | |
| makepkg --printsrcinfo > .SRCINFO | |
| - name: Commit and push | |
| run: | | |
| cd aur-repo | |
| git add PKGBUILD .SRCINFO | |
| git commit -m "Update gitfetch-python to v${{ steps.get_version.outputs.version }}" | |
| GIT_SSH_COMMAND="ssh -i ~/.ssh/aur_key -o UserKnownHostsFile=~/.ssh/known_hosts" git push |