-
-
Notifications
You must be signed in to change notification settings - Fork 8
56 lines (48 loc) · 1.96 KB
/
alfred-workflow-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Alfred Workflow Release
on:
push:
tags: ["*"]
env:
WORKFLOW_NAME: ${{ github.event.repository.name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
#───────────────────────────────────────────────────────────────────────────────
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# by default, no tags and only a single commit is fetched. To use git
# history in the next step, we need to fetch all history.
with:
fetch-depth: 0 # 0 = all history
fetch-tags: true
- name: Create changelog
run: |
count_tags="$(git tag | wc -l)"
if [[ $count_tags -ge 2 ]]; then
previous_tag=$(git tag --sort=-creatordate | head -2 | tail -1)
ref="$previous_tag"
else
root_commit=$(git rev-list --max-parents=0 HEAD)
ref="$root_commit"
fi
prev_commit_messages=$(git log "$ref"..HEAD^ --format='- %s' |
sed -E "s/^- ([^ ]+): /- **\1**: /")
echo "### Changelog" > CHANGELOG.txt
echo "$prev_commit_messages" >> CHANGELOG.txt
- name: Build .alfredworkflow
run: |
zip --recurse-paths --symlinks "${{ env.WORKFLOW_NAME }}.alfredworkflow" . \
--exclude "README.md" "CHANGELOG.txt" \
".git*" "Justfile" ".build-and-release.sh" ".rsync-exclude" \
".editorconfig" ".typos.toml" ".markdownlint.*"
# DOCS https://github.com/softprops/action-gh-release?tab=readme-ov-file#%EF%B8%8F-uploading-release-assets
- name: Release
uses: softprops/action-gh-release@v2
with:
token: ${{ env.GITHUB_TOKEN }}
body_path: CHANGELOG.txt
files: ${{ env.WORKFLOW_NAME }}.alfredworkflow