Assemble the files within a source directory into an Alfred workflow single package ready to be distributed.
The name of the output file is generated from the workflow name and version contained in the workflow's metadata.
This action needs a file named info.plist
with the metadata of your workflow in the root of your repo. This file is automatically generated for you when exporting workflows via the Alfred GUI.
workflow_dir
: Directory containing the sources of the workflow (defaults toworkflow
)exclude_patterns
: List of excluded files/directoriestemplate_files
: List of comma separated paths to files that would be used to template yourinfo.plist
file.
let's imagine that you have a
Script filter
where you wrote your python code, but you would like to develop the code using an IDE like pycharm, so using the option you can form your workflow from several files.To be able to add content of the files into you should put a template string into
info.plist
with the following structure:TEMPLATE_THIS_[0-9]+
.
For example, if you want to put content of two files intoinfo.plist
, you should settemplate_files: "example1.py,example2.py"
, and put the template strings to theinfo.plist
... <string>TEMPLATE_THIS_1 </string> ... <string>TEMPLATE_THIS_2 </string> ...each file will correspond to each template accordingly:
example1.py
will replaceTEMPLATE_THIS_1
andexample2.py
will replaceTEMPLATE_THIS_2
also you can put one file several times, just put the same template string to several places:... <string>TEMPLATE_THIS_1 </string> ... <string>TEMPLATE_THIS_2 </string> ... <string>TEMPLATE_THIS_1 </string> ...
workflow_file
: The name of the created .alfredworkflow file
On every push
to a tag matching the pattern v*
, create a release with the workflow file attached:
name: Create Alfred Workflow
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Alfred Workflow
id: alfred_builder
uses: com30n/build-alfred-workflow@v1
with:
workflow_dir: .
exclude_patterns: '*.pyc *__pycache__/*'
custom_version: ${{ github.ref_name }}
- name: Create Release
id: create_release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Alfred Workflow
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.alfred_builder.outputs.workflow_file }}
asset_name: ${{ steps.alfred_builder.outputs.workflow_file }}
asset_content_type: application/zip
In addition to the files and folders contained in the workflow_dir
some other files are also implicitily shipped within the target workflow_file
. These files are searched for in the root directory and are silently ignored in case they don't exist:
info.plist
(required)icon.png
README
,README.md
LICENSE