11name : Release Obsidian Plugin
22
3- # Triggered on tags of the form `obsidian-v0.1.0`. The version after the
4- # prefix MUST exactly equal `surfsense_obsidian/manifest.json`'s `version`
5- # (no leading `v`) — this is what BRAT and the Obsidian community plugin
6- # store both verify.
3+ # Tag format: `obsidian-v<version>` and `<version>` must match `surfsense_obsidian/manifest.json` exactly.
74on :
85 push :
96 tags :
@@ -26,14 +23,14 @@ jobs:
2623 working-directory : surfsense_obsidian
2724
2825 steps :
29- - uses : actions/checkout@v4
26+ - uses : actions/checkout@v6
3027 with :
3128 # Need write access for the manifest/versions.json mirror commit
3229 # back to main further down.
3330 fetch-depth : 0
3431 token : ${{ secrets.GITHUB_TOKEN }}
3532
36- - uses : actions/setup-node@v4
33+ - uses : actions/setup-node@v6
3734 with :
3835 node-version : 20.x
3936 cache : npm
4239 - name : Resolve plugin version
4340 id : version
4441 run : |
45- tag="${GITHUB_REF_NAME:-${{ github.event.inputs.tag }}}"
42+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
43+ tag="${{ github.event.inputs.tag }}"
44+ else
45+ tag="${GITHUB_REF_NAME}"
46+ fi
47+ if [ -z "$tag" ] || [[ "$tag" != obsidian-v* ]]; then
48+ echo "::error::Invalid tag '$tag'. Expected format: obsidian-v<version>"
49+ exit 1
50+ fi
4651 version="${tag#obsidian-v}"
4752 manifest_version=$(node -p "require('./manifest.json').version")
4853 if [ "$version" != "$manifest_version" ]; then
@@ -79,19 +84,14 @@ jobs:
7984 git add manifest.json versions.json
8085 git commit -m "chore(obsidian-plugin): mirror manifest+versions for ${{ steps.version.outputs.tag }}"
8186 # Push to the default branch so Obsidian can fetch raw files from HEAD.
82- git push origin HEAD:${{ github.event.repository.default_branch }}
87+ if ! git push origin HEAD:${{ github.event.repository.default_branch }}; then
88+ echo "::warning::Failed to push mirrored manifest/versions to default branch (likely branch protection). Continuing release."
89+ fi
8390
84- # IMPORTANT: BRAT and the Obsidian community plugin store look up the
85- # release by the bare manifest `version` (e.g. `0.1.0`), NOT by the
86- # build-trigger tag (`obsidian-v0.1.0`). So we publish the GitHub
87- # release with `tag_name: <version>` — `softprops/action-gh-release`
88- # will create that tag if it doesn't already exist, pointing at the
89- # commit referenced by the build-trigger tag. Verified against
90- # https://github.com/khoj-ai/khoj/releases (their tags are bare
91- # versions like `2.0.0-beta.28`, no prefix).
91+ # Publish release under bare `manifest.json` version (no `obsidian-v` prefix) for BRAT/store compatibility.
9292 - name : Create GitHub release
9393 if : github.event_name == 'push'
94- uses : softprops/action-gh-release@v2
94+ uses : softprops/action-gh-release@v3
9595 with :
9696 tag_name : ${{ steps.version.outputs.version }}
9797 name : SurfSense Obsidian Plugin ${{ steps.version.outputs.version }}
0 commit comments