👷 add default GH release machinery

This commit is contained in:
Erin Schnabel 2025-10-07 10:55:10 -04:00
parent ac9a2f3f2b
commit 1f90617591
No known key found for this signature in database
6 changed files with 346 additions and 0 deletions

80
.github/ISSUE_TEMPLATE/bug-report.yaml vendored Normal file
View file

@ -0,0 +1,80 @@
name: Bug Report
description: File a bug report
title: "🐛 "
labels: ["type: bug"]
body:
- type: markdown
attributes:
value: |
## Before you start
- Check for plugin updates and make sure you're running the latest version of the plugin.
- Restart Obsidian and see if the issue persists.
- Look at existing bug reports to see if your issue has already been reported.
- Is this actually a bug? If this is something that you wish the plugin could do, please submit a feature request instead.
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: What did you expect to happen?
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: Current behaviour
description: |
Describe what actually happened.
Be specific about the actions you took.
Screenshots or short recordings help, especially if the issue is visual.
validations:
required: true
- type: checkboxes
id: operating-systems
attributes:
label: Which Operating Systems are you using?
description: You may select more than one.
options:
- label: Android
- label: iPhone/iPad
- label: Linux
- label: macOS
- label: Windows
- type: input
id: obsidian-version
attributes:
label: Obsidian Version
description: Which Obsidian version are you using?
placeholder: 1.9.0
validations:
required: true
- type: input
id: plugin-version
attributes:
label: Plugin Version
description: Which plugin version are you using?
placeholder: 0.1.0
validations:
required: true
- type: checkboxes
id: other-plugins-disabled
attributes:
label: Checks
description: Please confirm
options:
- label: I have tried it in the sandbox vault with only this plugin enabled
required: false
- type: textarea
id: possible-solution
attributes:
label: Possible solution
description: |
Not obligatory, but please suggest a fix or reason for the bug, if you have an idea.

View file

@ -0,0 +1,46 @@
name: Feature Request
description: Request a new feature
title: "✨ "
labels: ["type: enhancement"]
body:
- type: textarea
id: feature-description
validations:
required: true
attributes:
label: "🔖 Feature description"
description: |
A clear and concise description of what the feature request is.
Include your use case.
Examples:
- I find it difficult to [...].
- I would like to be able to [...]. This would help me [...].
placeholder: "You should add ..."
- type: textarea
id: solution
validations:
required: true
attributes:
label: "✔️ Solution"
description: "A clear and concise description of what you want to happen."
placeholder: "In my use-case, ..."
- type: textarea
id: alternatives
validations:
required: false
attributes:
label: "❓ Alternatives"
description: "A clear and concise description of any alternative solutions or features you've considered."
placeholder: "I have considered ..."
- type: textarea
id: additional-context
validations:
required: false
attributes:
label: "📝 Additional Context"
description: "Add any other context or screenshots about the feature request here."
placeholder: "..."

37
.github/changelog.hbs vendored Normal file
View file

@ -0,0 +1,37 @@
{{#each releases}}
{{#if href}}
###{{#unless major}}#{{/unless}} [{{title}}]({{href}})
{{else}}
#### {{title}}
{{/if}}
{{#if tag}}
> {{niceDate}}
{{/if}}
{{#if summary}}
{{summary}}
{{/if}}
{{#if fixes}}
Fixes:
{{#each fixes}}
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{commit.subject}} {{#each fixes}}#{{id}} {{/each}}
{{/each}}
{{/if}}
{{#if commits}}
Commits:
{{#each commits}}
- {{#if breaking}}**Breaking change:** {{/if}}{{subject}}{{#if href}} [`{{shorthash}}`]({{href}}){{/if}}
{{/each}}
{{/if}}
{{#if merges}}
PRs:
{{#each merges}}
- #{{id}} {{#if commit.breaking}}**Breaking change:** {{/if}}{{message}}
{{/each}}
{{/if}}
{{/each}}

19
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
cooldown:
default-days: 30
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 30

37
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: Build and Test Obsidian Plugin
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '**.ts'
- '**.json'
- '**.scss'
- '**.css'
pull_request:
branches: [ main ]
paths:
- '**.ts'
- '**.json'
- '**.scss'
- '**.css'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Use Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: '20'
cache: 'npm'
- name: Build and Test
id: build
run: |
npm install
npm run build
# npm run test

127
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,127 @@
name: Release Obsidian Plugin
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
inputs:
version:
description: 'New version or major, minor, patch'
default: 'patch'
required: true
update_manifest:
description: 'Update manifest.json'
default: true
required: true
type: boolean
update_brat:
description: 'Update brat manifest'
default: true
required: true
type: boolean
retry:
description: "Retry release (clear created tag)"
default: false
required: true
type: boolean
env:
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GH_BOT_NAME: "GitHub Action"
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build.outputs.version }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Use Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: '20'
cache: 'npm'
# Build the plugin
- name: Build and Tag
id: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "version: ${{ github.event.inputs.version }}"
echo "retry: ${{ github.event.inputs.retry }}"
echo "update_manifest: ${{ github.event.inputs.update_manifest }}"
echo "update_brat: ${{ github.event.inputs.update_brat }}"
git config user.name ${{ env.GH_BOT_NAME }}
git config user.email ${{ env.GH_BOT_EMAIL }}
npm install
if [[ "${{ github.event.inputs.retry }}" = "true" ]]; then
npm run preversion
else
npm version ${{ github.event.inputs.version }} --no-git-tag-version
fi
VERSION=$(grep '^ "version"' package.json | cut -d'"' -f4)
echo $VERSION
if git rev-parse "refs/tags/$VERSION" > /dev/null 2>&1; then
if [[ "${{ github.event.inputs.retry }}" = "true" ]]; then
gh release delete $VERSION --cleanup-tag --yes
else
echo "🛑 Tag $VERSION already exists"
exit 1
fi
fi
if [ "${{ github.event.inputs.update_manifest }}" = "true" ]; then
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest.json
fi
if [ "${{ github.event.inputs.update_brat }}" = "true" ]; then
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest-beta.json
fi
git add .
git status
git commit -m "🔖 $VERSION"
git push
git tag $VERSION
git push --tags
npm run brat-notes -- ${VERSION}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
# Package the required files into a zip
- name: Package
run: |
mkdir ${{ github.event.repository.name }}
cp ./build/* ${{ github.event.repository.name }}
zip -r ${{ github.event.repository.name }}-${{ steps.build.outputs.version }}.zip ${{ github.event.repository.name }}
# Create the release on github
- name: Create Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
prerelease=true
if [ ${{ github.event.inputs.update_manifest }} ]; then
prerelease=false
fi
gh release create "${{ steps.build.outputs.version }}" \
-F ./release-notes.md \
--title "Release ${{ steps.build.outputs.version }}" \
--discussion-category "Announcements" \
--verify-tag \
--prerelease=${prerelease}
gh release upload "${{ steps.build.outputs.version }}" --clobber \
${{ github.event.repository.name }}-${{ steps.build.outputs.version }}.zip \
'./build/main.js#main.js' \
'./build/styles.css#styles.css' \
'./manifest.json' \
'./manifest-beta.json'