Files
cursor-nixos-flake/.github/workflows/update-cursor.yml
T
Olivier fe9d8ba55a fix(ci): refresh AppImage hashes when Cursor version is unchanged
Cursor can republish the same semver with a new build; the updater
previously skipped prefetch when the version matched, leaving stale
sha256 values. In CI, always re-prefetch and commit when flake.nix drifts.
2026-06-02 23:03:37 -03:00

89 lines
2.5 KiB
YAML

name: Update Cursor Version
on:
schedule:
- cron: '0 12 * * *' # Run daily at 12:00 UTC
workflow_dispatch: # Allow manual triggering
concurrency:
group: update-cursor
cancel-in-progress: true
jobs:
update-cursor:
runs-on: ubuntu-latest
env:
CI: true
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Nix
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Update Cursor using script
id: update-cursor
run: |
# Make the script executable
chmod +x update-cursor.sh
# Run the update script (it will auto-confirm in CI mode)
./update-cursor.sh
- name: Update flake lock file
if: steps.update-cursor.outputs.CURSOR_VERSION_INFO != 'no_update'
run: |
nix flake update
- name: Test the updated flake
if: steps.update-cursor.outputs.CURSOR_VERSION_INFO != 'no_update'
run: |
nix flake check --no-build
nix build .#cursor --dry-run
- name: Commit and push changes
run: |
# Get version info from the update step
VERSION_INFO="${{ steps.update-cursor.outputs.CURSOR_VERSION_INFO }}"
# Only commit if there was an actual update
if [[ "$VERSION_INFO" == "no_update" ]]; then
echo "No Cursor update needed, skipping commit"
exit 0
fi
# Check if there are any changes to commit
if git diff --quiet; then
echo "No changes to commit"
exit 0
fi
# Create commit message based on version info
if [[ "$VERSION_INFO" == completed:* ]]; then
OLD_VERSION=$(echo "$VERSION_INFO" | cut -d: -f2)
NEW_VERSION=$(echo "$VERSION_INFO" | cut -d: -f3)
if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then
COMMIT_MSG="Refresh Cursor $NEW_VERSION AppImage hashes"
else
COMMIT_MSG="Update Cursor to version $NEW_VERSION"
fi
else
COMMIT_MSG="Update Cursor to latest version"
fi
echo "Commit message: $COMMIT_MSG"
git config --local user.email "git@chiasson.cloud"
git config --local user.name "Gitea Action"
git add flake.nix flake.lock
git commit -m "$COMMIT_MSG"
git push