mirror of
https://github.com/eoinhurrell/obsidian-inboxer.git
synced 2026-07-22 05:46:47 +00:00
- Add GitHub artifact attestation for main.js in release workflow - Pin @types/jest to exact version 29.5.14 - Commit bun.lock by removing it from .gitignore
102 lines
3.8 KiB
YAML
102 lines
3.8 KiB
YAML
name: Release Obsidian Plugin
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "[0-9]+.[0-9]+.[0-9]+" # Matches standard semantic version tags without "v" prefix
|
|
- "debug-*" # Also run on non-release debugging
|
|
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
attestations: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.1.42
|
|
|
|
- name: Get version from tag
|
|
id: get_version
|
|
run: |
|
|
# Extract version from tag
|
|
VERSION=${GITHUB_REF_NAME#v}
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
echo "Building release for version: $VERSION"
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Build plugin
|
|
run: bun run build
|
|
|
|
- name: Attest build provenance
|
|
if: ${{ !startsWith(github.ref_name, 'debug-') }}
|
|
uses: actions/attest-build-provenance@v2
|
|
with:
|
|
subject-path: main.js
|
|
|
|
- name: Verify versions match
|
|
run: |
|
|
# Check if tag version matches package.json, manifest.json and exists in versions.json
|
|
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
MANIFEST_VERSION=$(node -p "require('./manifest.json').version")
|
|
|
|
if [[ "$PKG_VERSION" != "$VERSION" ]]; then
|
|
echo "⚠️ Warning: Tag version ($VERSION) doesn't match package.json version ($PKG_VERSION)"
|
|
fi
|
|
|
|
if [[ "$MANIFEST_VERSION" != "$VERSION" ]]; then
|
|
echo "⚠️ Warning: Tag version ($VERSION) doesn't match manifest.json version ($MANIFEST_VERSION)"
|
|
fi
|
|
|
|
if ! node -e "const vs=require('./versions.json'); if(!vs['$VERSION']) throw 'Version not found'"; then
|
|
echo "⚠️ Warning: Version $VERSION not found in versions.json"
|
|
fi
|
|
- name: Update CHANGELOG
|
|
if: ${{ !startsWith(steps.tag.outputs.tag_name, 'debug-') }}
|
|
id: changelog
|
|
uses: requarks/changelog-action@v1
|
|
with:
|
|
token: ${{ github.token }}
|
|
tag: ${{ env.VERSION }}
|
|
|
|
- name: Create GitHub Release
|
|
if: ${{ !startsWith(steps.tag.outputs.tag_name, 'debug-') }}
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |-
|
|
main.js
|
|
manifest.json
|
|
name: Version ${{ env.VERSION }}
|
|
body: |
|
|
## Inboxer v${{ env.VERSION }}
|
|
|
|
Please refer to the [changelog](https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md) for details.
|
|
|
|
### Changes
|
|
${{ steps.changelog.outputs.changes }}
|
|
|
|
### Installation
|
|
1. Download `main.js` and `manifest.json` from the release assets
|
|
2. Place them in your Obsidian vault's plugins folder: `.obsidian/plugins/inboxer/`
|
|
3. Enable the plugin in Obsidian settings
|
|
draft: false
|
|
prerelease: false
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Commit CHANGELOG.md
|
|
if: ${{ !startsWith(steps.tag.outputs.tag_name, 'debug-') }}
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
branch: master
|
|
commit_message: "docs: update CHANGELOG.md for v${{ env.VERSION }} [skip ci]"
|
|
file_pattern: CHANGELOG.md
|