Skip to content

godbout/AlfredWorkflowUpdater

Repository files navigation

Alfred Workflow Updater

GitHub Release Build Status Code Coverage


What is that

It's a Command Line Tool that you embed in your Workflow. That is it.

Then you call it from your Workflow and it does some magic.

Why

Who wants to go check GitHub or a forum post manually to update your Workflow hmm?

Features

  • checks for updates on GitHub in the background
  • only checks when necessary (frequency checks)
  • opens your GitHub release page if you want
  • downloads your latest release, moves it to the Users' download folder, opens the workflow
  • notifications of your download come from your Workflow, so it's non-blocking and uses your icon ✌🏼️

OK, how does it work in real

Alfred Workflow Updater writes a file called last_checked.plist in your Workflow cache folder that holds information about the last online check. When the threshold you specified as a argument (see API) is passed, Alfred Workflow Updater checks online if there's an update available for your Workflow, comparing your current local Workflow version against the online latest version available on GitHub. If a an update is found, Alfred Workflow Updater drops an update_available.plist file in your Workflow cache folder. This file contains your latest release info (version, file URL, page URL).

All you have to do is pick up that file and show the update whenever and however you want in your own Alfred Workflow.

Hmm, any screenshot?

Better, a video:

AlfredWorkflowUpdater.mp4

API

in your Workflow Script

  1. Call the Alfred Workflow Updater tool with 2 parameters:

  2. Add an Environment Variable called alfred_workflow_updater_asset_name that contains the name of your Alfred Workflow file as shown in the GitHub Releases. This is necessary because GitHub now loads assets dynamically and we can't grab the asset name through HTML scrapping.

in your Alfred Results

You can:

  1. generate an update of your Workflow by adding an item variable to your Alfred Result with the name AlfredWorkflowUpdater_action and the value update
  2. open your Workflow's GitHub release page by adding an item variable to your Alfred Result with the name AlfredWorkflowUpdater_action and the value open

You do not need to pass any other variables with those Alfred Results. The Alfred Workflow Updater will grab the necessary info from your Workflow's cache folder instead.

Any concrete example?

The following Workflows are using the Alfred Workflow Updater. Best is to download one of them, open it, and check how it's made (it's simple):