wiseguru_ReWrite-Voice-Notes/.github/workflows/release.yml
WiseGuru 01e3fb8d75 Release workflow: publish suffixed tags (alpha/beta) as GitHub prereleases
A tag containing a "-" now stamps its version into the *published*
manifest.json only (master stays at the last stable version) and sets
prerelease: true, so the official updater and community review never see
it while BRAT / manual install can. Process docs: RELEASING.md
"Pre-release (alpha/beta) builds".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:55:24 -07:00

82 lines
2.5 KiB
YAML

name: Release
# Build, attest provenance, and publish release assets when a version tag is pushed.
# Obsidian tags are bare versions with no leading "v" (e.g. 1.0.0).
# A tag carrying a pre-release suffix (a "-", e.g. 1.3.0-alpha / 1.3.0-beta.1) is
# published as a GitHub *prerelease*: GitHub's "latest release" (what Obsidian's
# updater reads) excludes prereleases, so the official channel never sees it, while
# BRAT / manual install still can. See docs/RELEASING.md.
on:
push:
tags:
- '*'
permissions:
contents: write
id-token: write
attestations: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
# A tag with a "-" (e.g. 1.3.0-alpha) is a pre-release channel.
- name: Determine release channel
id: channel
shell: bash
run: |
if [[ "${{ github.ref_name }}" == *-* ]]; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
# Master's manifest.json stays at the last stable version during alpha/beta
# testing, so stamp the tag's version into the *published* manifest only.
# (Stable tags publish manifest.json as committed; this step is skipped.)
- name: Stamp pre-release version into manifest
if: steps.channel.outputs.prerelease == 'true'
shell: bash
env:
TAG: ${{ github.ref_name }}
run: |
node -e '
const fs = require("fs");
const m = JSON.parse(fs.readFileSync("manifest.json", "utf8"));
m.version = process.env.TAG;
fs.writeFileSync("manifest.json", JSON.stringify(m, null, "\t"));
'
- name: Build
run: npm run build
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: |
main.js
manifest.json
styles.css
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
prerelease: ${{ steps.channel.outputs.prerelease }}
files: |
main.js
manifest.json
styles.css