Skip to content

Commit

Permalink
build: simplify release script
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Nov 27, 2024
1 parent 3101a84 commit 970c2c2
Showing 1 changed file with 5 additions and 30 deletions.
35 changes: 5 additions & 30 deletions .github/workflows/alfred-workflow-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,26 @@ on:

env:
WORKFLOW_NAME: ${{ github.event.repository.name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

permissions:
contents: write

#───────────────────────────────────────────────────────────────────────────────

jobs:
build:
runs-on: macos-latest
permissions: { contents: write }
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.*"
--exclude "README.md" ".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
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
files: ${{ env.WORKFLOW_NAME }}.alfredworkflow

0 comments on commit 970c2c2

Please sign in to comment.