name: Release # Triggers when you push a SemVer tag like `0.1.4` (no `v` prefix — matches Obsidian # community-plugin convention and the existing versions.json entries). on: push: tags: - "[0-9]+.[0-9]+.[0-9]+" permissions: contents: write # create release + upload assets id-token: write # sign attestations attestations: write # publish build provenance for release assets 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" - name: Install dependencies # When a package-lock.json is committed, switch this to `npm ci` for # reproducible installs. Until then, `npm install` resolves against # package.json on the fly. run: npm install --no-audit --no-fund - name: Build run: npm run build - name: Verify manifest version matches tag run: | MANIFEST_VERSION=$(node -p "require('./manifest.json').version") TAG_VERSION="${GITHUB_REF_NAME}" if [ "$MANIFEST_VERSION" != "$TAG_VERSION" ]; then echo "::error::manifest.json version ($MANIFEST_VERSION) does not match tag ($TAG_VERSION)" exit 1 fi - name: Generate artifact attestations # Attaches GitHub-signed build provenance to each release asset so the # Obsidian community scanner's "release assets missing GitHub artifact # attestation" finding clears. uses: actions/attest-build-provenance@v2 with: subject-path: | main.js manifest.json styles.css - name: Create GitHub release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release create "$GITHUB_REF_NAME" \ --title "$GITHUB_REF_NAME" \ --generate-notes \ main.js manifest.json styles.css