obsidian-media-db-sync/.github/workflows/release.yml
afiqzudinhadi 7045a2404c docs(readme): split user and build tracks; fix release for BRAT
README interleaved plugin usage with build steps, so a user wanting only
the plugin had to read past clone/bun/build. Now two tracks: install,
config, commands, settings, note schema, issues first; build and dev
after a divider.

Also adds the standalone note (fork carries the whole upstream plugin,
stock one not needed; keys and settings are not shared) and splits the
bun requirement into tests (hard, bun:test + mock.module) vs build
(tsc + vite, node-capable).

release.yml: no tag was ever pushed, so BRAT had nothing to install.
Two defects fixed:
- prerelease flag only tripped on 'canary', so a beta tag would have
  published as stable. Now any semver prerelease tag (contains '-').
- release shipped manifest.json 0.1.0 while BRAT resolves the tag from
  manifest-beta.json 0.1.0-beta.1. Version mismatch makes BRAT
  re-download every check. Prerelease tags now ship manifest-beta.json
  as manifest.json.
2026-08-06 01:30:31 +08:00

77 lines
2.7 KiB
YAML

name: Create Plugin Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching any tag format, i.e. 1.0, 20.15.10
env:
PLUGIN_NAME: media-db-sync # Change this to the name of your plugin-id folder
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Determine prerelease status
id: status
run: |
# Any semver prerelease tag (0.1.0-beta.1, 0.8.0-canary.x, 1.0.0-rc.1) ships as a prerelease.
if [[ "${{ github.ref_name }}" == *"-"* ]]; then
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Build
id: build
env:
TAG: ${{ github.ref_name }}
run: |
bun install --frozen-lockfile
bun run build
# BRAT resolves the tag from manifest-beta.json, then installs the manifest.json
# shipped in that release. On a prerelease tag the two must agree, or BRAT reads
# back a different version than it installed and re-downloads forever.
if [[ "$TAG" == *"-"* ]]; then
cp manifest-beta.json dist/manifest.json
fi
mkdir ${{ env.PLUGIN_NAME }}
cp dist/main.js dist/manifest.json dist/styles.css ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}-${{ github.ref_name }}.zip ${{ env.PLUGIN_NAME }}
ls
- name: Attest build provenance
uses: actions/attest@v4
with:
subject-path: |
dist/main.js
dist/manifest.json
dist/styles.css
${{ env.PLUGIN_NAME }}-${{ github.ref_name }}.zip
- name: Release
id: release
uses: softprops/action-gh-release@v3
with:
prerelease: ${{ steps.status.outputs.prerelease }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
${{ env.PLUGIN_NAME }}-${{ github.ref_name }}.zip
dist/main.js
dist/manifest.json
dist/styles.css