sbuffkin_hexmaker/.github/workflows/release.yml
nyxsys eac08dea00 ci: auto-release on master push with generated changelog
- Release workflow now triggers on push to master instead of manual tag
- Reads version from manifest.json, skips if release already exists
- Creates git tag and publishes release with --generate-notes automatically
- CI restricted to branch pushes to avoid double-run on tag creation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 23:31:54 -04:00

65 lines
1.8 KiB
YAML

name: Release Obsidian plugin
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read version from manifest
id: version
run: echo "version=$(node -p "require('./manifest.json').version")" >> $GITHUB_OUTPUT
- name: Check if release already exists
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "${{ steps.version.outputs.version }}" &>/dev/null; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Use Node.js
if: steps.check.outputs.exists == 'false'
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Install dependencies
if: steps.check.outputs.exists == 'false'
run: npm ci
- name: Run tests
if: steps.check.outputs.exists == 'false'
run: npm test
- name: Build plugin
if: steps.check.outputs.exists == 'false'
run: npm run build
- name: Tag and create release
if: steps.check.outputs.exists == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version="${{ steps.version.outputs.version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$version" -m "$version"
git push origin "$version"
gh release create "$version" \
--title="$version" \
--generate-notes \
main.js manifest.json styles.css