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