68 lines
2.3 KiB
YAML
68 lines
2.3 KiB
YAML
name: Update Cursor IDE Package
|
|
|
|
on:
|
|
schedule:
|
|
# Check every hour
|
|
- cron: '0 * * * *'
|
|
workflow_dispatch:
|
|
inputs:
|
|
force_publish:
|
|
description: 'Force publish current version to AUR'
|
|
type: boolean
|
|
default: false
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
check-and-update:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '25'
|
|
|
|
- name: Check for new version
|
|
id: check
|
|
run: |
|
|
node update.ts --check > check_result.json
|
|
echo "result<<EOF" >> "$GITHUB_OUTPUT"
|
|
cat check_result.json >> "$GITHUB_OUTPUT"
|
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
|
|
|
UPDATE=$(node -e "const d=JSON.parse(require('fs').readFileSync('check_result.json','utf8')); console.log(d.update_available ? 'true' : 'false')")
|
|
echo "update_available=$UPDATE" >> "$GITHUB_OUTPUT"
|
|
echo "latest_version=$(node -e "const d=JSON.parse(require('fs').readFileSync('check_result.json','utf8')); console.log(d.latest_version)")" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Update PKGBUILD
|
|
if: steps.check.outputs.update_available == 'true' && !inputs.force_publish
|
|
run: |
|
|
node update.ts --update
|
|
echo "Updated to version $(grep '^pkgver=' PKGBUILD | cut -d= -f2)"
|
|
|
|
- name: Publish to AUR
|
|
if: steps.check.outputs.update_available == 'true' || inputs.force_publish
|
|
uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
|
|
with:
|
|
pkgname: cursor
|
|
pkgbuild: ./PKGBUILD
|
|
commit_username: ${{ github.repository_owner }}
|
|
commit_email: ${{ secrets.AUR_EMAIL }}
|
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
|
# Files to copy to AUR repo
|
|
assets: |
|
|
PKGBUILD
|
|
.SRCINFO
|
|
cursor.desktop
|
|
cursor-launcher.sh
|
|
|
|
- name: Commit updated PKGBUILD to GitHub
|
|
if: steps.check.outputs.update_available == 'true' && !inputs.force_publish
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add PKGBUILD .SRCINFO
|
|
git commit -m "Update to Cursor ${{ steps.check.outputs.latest_version }}"
|
|
git push
|