diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a6045a3 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,39 @@ +name: Publish + +on: + push: + tags: + - "*" + +permissions: + contents: read + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Setup repo + uses: actions/checkout@v3 + + - name: Fetch all tags + run: git fetch --force --tags + + - name: Setup Deno + # uses: denoland/setup-deno@v1 + uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2 + with: + deno-version: v1.x + + - name: Build + run: deno task build + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org" + + - name: Publish to NPM + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index fe53cc6..849ddff 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -dest/ \ No newline at end of file +dist/ diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..ababd7a --- /dev/null +++ b/.npmrc @@ -0,0 +1,3 @@ +//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} +registry=https://registry.npmjs.org/ +always-auth=true diff --git a/package.json b/package.json index c99e716..0e899c7 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "scripts": { "build": "deno task build" }, + "main": "dist/index.js", "exports": { "./*": "./dist/*.js" }, @@ -14,5 +15,9 @@ "colors", "palette", "tailwind" ], "sideEffects": false, + "repository": { + "type": "git", + "url": "https://github.com/evilmartians/harmony.git" + }, "license": "MIT" -} \ No newline at end of file +} diff --git a/scripts/build.ts b/scripts/build.ts index b3bdba1..dd6cfa2 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -6,7 +6,7 @@ import { buildBasicPalette } from "./targets/base.ts"; // Config // const SOURCE_FILE = "./source.json"; -const DEST_DIR = path.join(Deno.cwd(), "dest"); +const DIST_DIR = path.join(Deno.cwd(), "dist"); // // Export targets @@ -49,11 +49,11 @@ export type ExportTarget = (args: { // // Main // -await createDistDir(DEST_DIR); +await createDistDir(DIST_DIR); const palette = await loadPalette(SOURCE_FILE); await Promise.all( TARGETS.map(({ targetDir, target }) => - runExportTarget(path.join(DEST_DIR, targetDir), target, palette) + runExportTarget(path.join(DIST_DIR, targetDir), target, palette) ), );