Skip to content

Commit

Permalink
feat: initial
Browse files Browse the repository at this point in the history
  • Loading branch information
colomolo committed Dec 13, 2023
0 parents commit 7e232b1
Show file tree
Hide file tree
Showing 9 changed files with 1,388 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release Alfred Workflow
on:
push:
branches:
- main

permissions:
contents: read # for checkout

jobs:
release:
name: Release
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx -p @semantic-release/git -p @semantic-release/github -p @semantic-release/exec semantic-release
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
prefs.plist
22 changes: 22 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"branches": ["main"],
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules": [
{"release": "patch"}
]
}],
"@semantic-release/release-notes-generator",
["@semantic-release/exec", {
"prepareCmd": "./.zip.sh ${nextRelease.version}"
}],
["@semantic-release/git", {
"assets": ["info.plist"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
["@semantic-release/github", {
"assets": ["Reading-list.alfredworkflow"]
}]
]
}
53 changes: 53 additions & 0 deletions .zip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# -----------------------
# new version number
# -----------------------

# Prompt for version number, if not entered
nextVersion="$*"
currentVersion=$(plutil -extract 'version' raw -o - info.plist)
echo "current version: $currentVersion"
echo -n " next version: "
if [[ -z "$nextVersion" ]]; then
read -r nextVersion
else
echo "$nextVersion"
fi

# insert new version number
plutil -replace version -string "$nextVersion" info.plist

# -----------------------
# clean info.plist
# -----------------------

# bkp info.plist
cp -v info.plist info-original.plist

# remove variables flagged as "no export" from info.plist
if plutil -extract 'variablesdontexport' json -o - info.plist &>/dev/null; then
excludedVars=$(plutil -extract variablesdontexport json -o - info.plist | tr -d "[]\"" | tr "," "\n")
echo "$excludedVars" | tr "\n" "\0" | xargs -0 -I {} plutil -replace variables.{} -string "" info.plist

exclusionNo=$(echo "$excludedVars" | wc -l | tr -d " ")
echo "Removed $exclusionNo variables flagged as 'no export' removed from 'info.plist'."
fi

# -----------------------
# compile .alfredworkflow
# -----------------------

# remove workflow file from previous release
rm -fv ./*.alfredworkflow

# zip
workflowName=$(plutil -extract 'name' raw -o - info.plist | tr " " "-")
# ".*" excludes the dotfiles (glob pattern, not regex)
zip --quiet -r "$workflowName.alfredworkflow" . -x ".*" "doc*/*" "prefs.plist" "info-original.plist" "*.md" "*.alfredworkflow" "*.gif"
echo "new $workflowName.alfredworkflow file created."

# restore original
rm -fv info.plist
mv -fv info-original.plist info.plist
echo
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
![String Multitool](./icon.png)

# Reading list

[Alfred](https://www.alfredapp.com/) workflow helping you manage your links and quick search notes.

## Usage
Use keyword `string` (or custom keyword) to init String Multitool. Provide string as an argument and select needed transformation from list.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7e232b1

Please sign in to comment.