Set up workflows

This commit is contained in:
Benji Grant 2024-07-19 13:39:46 +10:00
parent d5fab978f9
commit 33a9a841a8
No known key found for this signature in database
GPG key ID: D41929A51D291D4D
8 changed files with 1488 additions and 2 deletions

17
.changes/config.json Normal file
View file

@ -0,0 +1,17 @@
{
"gitSiteUrl": "https://github.com/GRA0007/obsidian-css-inlay-colors/",
"changeTags": {
"feat": "New Features",
"fix": "Bug Fixes",
"perf": "Performance Improvements"
},
"packages": {
"obsidian-css-inlay-colors": {
"version": true,
"path": ".",
"releaseTag": "${ pkgFile.version }",
"getPublishedVersion": "curl -s https://api.github.com/repos/GRA0007/obsidian-css-inlay-colors/releases/latest | jq -r '.tag_name'",
"publish": "echo publish"
}
}
}

31
.changes/readme.md Normal file
View file

@ -0,0 +1,31 @@
# Changes
##### via https://github.com/jbolda/covector
As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend that it represents the overall change for organizational purposes.
When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.
Use the following format:
```md
---
"package-a": patch
"package-b": minor
---
Change summary goes here
```
Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed.
Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/).
Given a version number MAJOR.MINOR.PATCH, increment the:
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards compatible manner, and
- PATCH version when you make backwards compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing).

41
.github/workflows/checks.yml vendored Normal file
View file

@ -0,0 +1,41 @@
name: Checks
on:
push:
branches:
- main
pull_request:
paths:
- "biome.json"
- "main.ts"
- "package.json"
- "tsconfig.json"
- "yarn.lock"
- ".github/workflows/checks.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- run: yarn biome ci --reporter=github --error-on-warnings
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- run: yarn tsc

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

@ -0,0 +1,68 @@
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
covector:
runs-on: ubuntu-latest
outputs:
releaseId: ${{ steps.covector.outputs.releaseId }}
commandRan: ${{ steps.covector.outputs.commandRan }}
shouldPublish: ${{ steps.covector.outputs.published-obsidian-css-inlay-colors }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for use of git history
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- uses: jbolda/covector/packages/action@covector-v0
id: covector
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: version-or-publish
createRelease: true
draftRelease: true
# If versioning (creating a version PR)
- name: update plugin manifest version
run: yarn run version
if: steps.covector.outputs.commandRan == 'version'
- name: create pr
uses: peter-evans/create-pull-request@v6
if: steps.covector.outputs.commandRan == 'version'
with:
title: Publish New Version
commit-message: Publish new version
labels: release
branch: release
body: ${{ steps.covector.outputs.change }}
release:
needs: covector
if: needs.covector.outputs.commandRan == 'publish' && needs.covector.outputs.shouldPublish == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- run: yarn build
- uses: xresloader/upload-to-github-release@v1.6.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.covector.outputs.releaseId }}
draft: false
file: main.js;manifest.json;styles.css

17
.github/workflows/status.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: Status
on: pull_request
jobs:
covector:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for use of git history
- uses: jbolda/covector/packages/action@covector-v0
id: covector
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: status
comment: true

View file

@ -33,6 +33,7 @@
"@types/culori": "^2.1.1",
"@types/node": "^20.14.11",
"builtin-modules": "3.3.0",
"covector": "^0.12.2",
"esbuild": "0.23.0",
"obsidian": "latest",
"tslib": "2.6.3",

View file

@ -6,9 +6,9 @@ const targetVersion = process.env.npm_package_version
const manifest = JSON.parse(readFileSync('manifest.json', 'utf8'))
const { minAppVersion } = manifest
manifest.version = targetVersion
writeFileSync('manifest.json', JSON.stringify(manifest, null, 2))
writeFileSync('manifest.json', `${JSON.stringify(manifest, null, 2)}\n`)
// update versions.json with target version and minAppVersion from manifest.json
const versions = JSON.parse(readFileSync('versions.json', 'utf8'))
versions[targetVersion] = minAppVersion
writeFileSync('versions.json', JSON.stringify(versions, null, 2))
writeFileSync('versions.json', `${JSON.stringify(versions, null, 2)}\n`)

1311
yarn.lock

File diff suppressed because it is too large Load diff