Removed the GitHub Actions workflow for Node.js CI and updated the release workflow to use the R2 upload action.

This commit is contained in:
Prad Nukala 2024-07-17 15:45:55 -04:00 committed by Prad Nukala (aider)
parent 473970b813
commit 165956a803
7 changed files with 31 additions and 48 deletions

View File

@ -1,30 +0,0 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [next]
pull_request:
branches: [next]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npx playwright install --with-deps
- run: npm ci
- run: npm run verify

View File

@ -3,15 +3,18 @@ name: Create GitHub Release
on:
push:
tags:
- "v2.*"
- "v3.*"
branches:
- "master"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: "marvinpinto/action-automatic-releases@v1.2.1"
- uses: ryand56/r2-upload-action@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: cdn-sonr-id
source-dir: cdn
destination-dir: ./

View File

@ -224,6 +224,21 @@ If an icon is used before registration occurs, it will be empty initially but sh
The following examples demonstrate how to register a number of popular, open source icon libraries via CDN. Feel free to adapt the code as you see fit to use your own origin or naming conventions.
### OxyIcons
Custom Sonr Icons.
```html:preview
<div style="font-size: 24px;">
<sl-icon library="oxy" name="anchor"></sl-icon>
<sl-icon library="oxy" name="snr"></sl-icon>
<sl-icon library="oxy" name="btc"></sl-icon>
<sl-icon library="oxy" name="sol"></sl-icon>
<sl-icon library="oxy" name="usdc"></sl-icon>
<sl-icon library="oxy" name="osmo"></sl-icon>
</div>
```
### Boxicons
This will register the [Boxicons](https://boxicons.com/) library using the jsDelivr CDN. This library has three variations: regular (`bx-*`), solid (`bxs-*`), and logos (`bxl-*`). A mutator function is required to set the SVG's `fill` to `currentColor`.

View File

@ -12,7 +12,7 @@ import { globby } from 'globby';
import path from 'path';
const { outdir } = commandLineArgs({ name: 'outdir', type: String });
const customIconDir = path.join(outdir, '/icons');
const customIconDir = path.join(outdir, '/assets/oxyicons');
const iconDir = path.join(outdir, '/assets/icons');
const iconPackageData = JSON.parse(await fs.readFile('./node_modules/bootstrap-icons/package.json', 'utf8'));
@ -37,7 +37,7 @@ await Promise.all([
]);
await fs.mkdir(customIconDir, { recursive: true });
await Promise.all([copy('./icons', iconDir)]);
await Promise.all([copy('./icons', customIconDir)]);
// Generate metadata
const files = await globby(`${srcPath}/docs/content/icons/**/*.md`);

View File

@ -1,9 +1,9 @@
import { getBasePath } from '../../utilities/base-path.js';
import type { IconLibrary } from './library.js';
const customLibrary: IconLibrary = {
const library: IconLibrary = {
name: 'oxy',
resolver: name => getBasePath(`icons/${name}.svg`)
resolver: name => getBasePath(`assets/oxyicons/${name}.svg`)
};
export default customLibrary;
export default library;

View File

@ -1,3 +1,4 @@
import customLibrary from './library.custom.js';
import defaultLibrary from './library.default.js';
import systemLibrary from './library.system.js';
import type SlIcon from '../icon/icon.js';
@ -11,7 +12,7 @@ export interface IconLibrary {
spriteSheet?: boolean;
}
let registry: IconLibrary[] = [defaultLibrary, systemLibrary];
let registry: IconLibrary[] = [defaultLibrary, systemLibrary, customLibrary];
let watchedIcons: SlIcon[] = [];
/** Adds an icon to the list of watched icons. */

View File

@ -1,10 +1,4 @@
import { getBasePath } from './utilities/base-path.js';
import { registerIconLibrary } from './utilities/icon-library.js';
registerIconLibrary('oxy', {
resolver: name => `https://cdn.sonr.id/icons/${name}.svg`,
mutator: svg => svg.setAttribute('fill', 'currentColor')
});
const observer = new MutationObserver(mutations => {
for (const { addedNodes } of mutations) {