Skip to content

Build obsidian plugin #48

Build obsidian plugin

Build obsidian plugin #48

Workflow file for this run

name: Build obsidian plugin
on:
workflow_dispatch:
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: obsidian-better-export-pdf # Change this to the name of your plugin-id folder
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "20.x" # You might need to adjust this value to your own version
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: ELECTRON_SKIP_BINARY_DOWNLOAD=1 && pnpm install
- name: Build
id: build
run: |
pnpm build
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
ls
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref }}
body: ${{steps.generate_changelog.outputs.changelog}}
files: |
main.js
manifest.json
./${{ env.PLUGIN_NAME }}.zip
- name: Generate Changelog
id: generate_changelog
run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}