mirror of
https://github.com/unabyss/obsidian-plugin.git
synced 2026-07-22 07:47:17 +00:00
- manifest: drop redundant "Obsidian" from description - settings: render logo as inline themed SVG (no shipped image assets, adapts via currentColor), move all inline styles to styles.css, use Setting().setHeading() for section headers, drop document/activeDocument access, and avoid returning a promise from a void event handler - syncInbound: use FileManager.trashFile to respect the user's deletion preference instead of Vault.trash - main: type catch parameters as unknown (no unsafe any) - apiClient: optional catch binding for the unused error - build: replace builtin-modules package with node:module builtinModules - release CI: attach only main.js/manifest.json/styles.css and add build provenance attestations - versions.json: backfill 1.0.1 and 1.1.1 Co-authored-by: Cursor <cursoragent@cursor.com>
93 lines
3.1 KiB
YAML
93 lines
3.1 KiB
YAML
name: Release Obsidian Plugin
|
|
|
|
# Triggered by pushing a SemVer tag (v*). Builds the production bundle
|
|
# and attaches only the files Obsidian downloads - main.js, manifest.json,
|
|
# and styles.css - to the GitHub Release. Obsidian ignores any other
|
|
# release assets, so none are attached.
|
|
#
|
|
# The Release is published under the BARE version tag (e.g. 1.1.0), not
|
|
# the pushed v-prefixed tag. Obsidian matches manifest.json "version"
|
|
# against a release tag with no "v" prefix, so the release must be 1.1.0
|
|
# even though the git trigger tag is v1.1.0.
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
attestations: write
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: "pnpm"
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Typecheck
|
|
run: pnpm run typecheck
|
|
|
|
- name: Run unit tests
|
|
run: pnpm test
|
|
|
|
- name: Build production bundle
|
|
run: pnpm run build
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: |
|
|
TAG="${GITHUB_REF##*/}"
|
|
VERSION="${TAG#v}"
|
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Verify manifest version matches tag
|
|
run: |
|
|
MANIFEST_VERSION="$(node -e 'process.stdout.write(require("./manifest.json").version)')"
|
|
if [ "$MANIFEST_VERSION" != "${{ steps.version.outputs.version }}" ]; then
|
|
echo "manifest.json version ($MANIFEST_VERSION) does not match tag (${{ steps.version.outputs.version }})"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Collect release artefacts
|
|
run: |
|
|
mkdir -p release
|
|
cp main.js manifest.json release/
|
|
if [ -f styles.css ]; then cp styles.css release/; fi
|
|
|
|
- name: Attest build provenance
|
|
uses: actions/attest-build-provenance@v2
|
|
with:
|
|
subject-path: |
|
|
release/main.js
|
|
release/manifest.json
|
|
|
|
- name: Publish GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.version.outputs.version }}
|
|
name: Unabyss Obsidian Plugin ${{ steps.version.outputs.version }}
|
|
draft: false
|
|
prerelease: false
|
|
files: |
|
|
release/main.js
|
|
release/manifest.json
|
|
release/styles.css
|
|
fail_on_unmatched_files: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|