mirror of
https://github.com/ccmdi/smart-link-formatter.git
synced 2026-07-22 12:50:25 +00:00
66 lines
No EOL
1.9 KiB
YAML
66 lines
No EOL
1.9 KiB
YAML
name: Release Obsidian plugin
|
|
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
attestations: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "22.x"
|
|
- name: Build plugin
|
|
run: |
|
|
npm install
|
|
npm run build
|
|
- name: Generate release notes from PRs
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
tag="${GITHUB_REF#refs/tags/}"
|
|
|
|
# Get all tags sorted by version, then get the one before current
|
|
previous_tag=$(git tag --sort=-version:refname | grep -A1 "^${tag}$" | tail -n1)
|
|
|
|
echo "## What's Changed" > release_notes.md
|
|
echo "" >> release_notes.md
|
|
|
|
if [ "$previous_tag" == "$tag" ] || [ -z "$previous_tag" ]; then
|
|
echo "Initial release" >> release_notes.md
|
|
else
|
|
echo "Comparing $previous_tag to $tag" >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
git log "$previous_tag..$tag" --merges --oneline | \
|
|
grep -oP '#\K\d+' | sort -u | while read pr_number; do
|
|
gh pr view "$pr_number" --json title,body --jq '"### " + .title + "\n\n" + .body + "\n"' >> release_notes.md 2>/dev/null || true
|
|
done
|
|
fi
|
|
|
|
- name: Attest build provenance
|
|
uses: actions/attest-build-provenance@v2
|
|
with:
|
|
subject-path: |
|
|
main.js
|
|
styles.css
|
|
|
|
- name: Create draft release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
tag="${GITHUB_REF#refs/tags/}"
|
|
gh release create "$tag" \
|
|
--title="$tag" \
|
|
--notes-file release_notes.md \
|
|
--draft \
|
|
main.js manifest.json styles.css |