Skip to content

Commit

Permalink
Add publish GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Buryak committed Oct 5, 2023
1 parent 321ac0a commit 9f4ed60
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 5 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dest/
dist/
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
registry=https://registry.npmjs.org/
always-auth=true
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scripts": {
"build": "deno task build"
},
"main": "dist/index.js",
"exports": {
"./*": "./dist/*.js"
},
Expand All @@ -14,5 +15,9 @@
"colors", "palette", "tailwind"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/evilmartians/harmony.git"
},
"license": "MIT"
}
}
6 changes: 3 additions & 3 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
),
);

Expand Down

0 comments on commit 9f4ed60

Please sign in to comment.