Skip to content

Commit

Permalink
chore: actions workflow with linter
Browse files Browse the repository at this point in the history
  • Loading branch information
bandantonio committed Mar 1, 2024
1 parent c3d2e61 commit 21c2fda
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"no-unused-vars": "warn",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
"no-prototype-builtins": "warn",
"@typescript-eslint/no-empty-function": "warn"
}
}
27 changes: 27 additions & 0 deletions .github/actions/node-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Node setup and cache'
description: 'Setup Node.js packages and restore cache'

inputs:
node-version:
description: 'Node version to use, default to 20'
required: true
default: '20'
outputs:
cache-hit:
description: 'Forward actions/cache cache-hit output'
value: ${{ steps.node-cache.outputs.cache-hit }}

runs:
using: 'composite'
steps:
- name: ⚙️ Setup node.js ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}

- name: 📦 Cache node modules
id: node-cache
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ inputs.node-version }}-${{ hashFiles('package-lock.json') }}
65 changes: 46 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,61 @@
name: Release Obsidian plugin

on:
push:
tags:
- "*"
name: Release Obsidian Plugin
on: [push]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
node-setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '20'
- run: npm i
if: steps.cache-node-modules.outputs.cache-hit != 'true'

run-lint:
name: ✅ Linter
needs: node-setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: "18.x"
node-version: '20'

- name: Build plugin
run: |
npm install
npm run build
- name: ✅ Run code style linter
id: linter
run: npm run lint

release-plugin:
name: 📦 Release Obsidian Plugin
needs: run-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-cache
id: cache-node-modules
with:
node-version: '20'

- name: 📗 Build plugin
id: build_plugin
if: steps.cache-node-modules.outcome == 'success'
run: npm run build

- name: Create release
- name: 📦 Create release
if: steps.build_plugin.outcome == 'success' && contains(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF#refs/tags/}"
tag='${GITHUB_REF#refs/tags/}'
gh release create "$tag" \
--title="$tag" \
gh release create '$tag' \
--title='$tag' \
--draft \
main.js manifest.json styles.css
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Import all your Apple Books highlights to Obsidian.

![GitHub Downloads](https://img.shields.io/github/downloads/bandantonio/obsidian-apple-books-highlights-plugin/total?style=for-the-badge&logo=github&color=573e7a)


## Overview

This plugin aims to be a **fast**, **customizable**, **reliable**, and **up-to-date** solution to import your Apple Books highlights to Obsidian:
Expand Down
1 change: 1 addition & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default class IBookHighlightsPlugin extends Plugin {
});
}

// @ts-ignore
onunload() { }

Check warning on line 54 in main.ts

View workflow job for this annotation

GitHub Actions / ✅ Linter

Unexpected empty method 'onunload'

async loadSettings() {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"lint": "eslint . --ext .ts",
"version": "node version-bump.mjs"
},
"keywords": [
Expand All @@ -31,6 +32,7 @@
"@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0",
"esbuild": "0.17.3",
"eslint": "^8.57.0",
"obsidian": "latest",
"tslib": "2.4.0",
"typescript": "4.7.4"
Expand All @@ -39,4 +41,4 @@
"handlebars": "^4.7.8",
"sqlite3": "^5.1.7-rc.0"
}
}
}
6 changes: 1 addition & 5 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"1.0.0": "0.15.0",
"1.0.1": "0.15.0",
"1.0.2": "0.15.0",
"1.1.0": "0.15.0",
"1.1.1": "0.15.0"
"1.0.0": "0.15.0"
}

0 comments on commit 21c2fda

Please sign in to comment.