Skip to content

Commit

Permalink
chore(deno): add readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
cyco130 committed Aug 19, 2023
1 parent e5348b8 commit 9984d8e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Publish to deno.land/x

on:
workflow_dispatch:
inputs:
version:
description: "Version to publish"
required: true
type: "string"

defaults:
run:
Expand Down Expand Up @@ -62,11 +67,15 @@ jobs:
git config --global user.name "HatTip Deno Release Bot"
git config --global user.email "<>"
git add .
git diff --quiet && git diff --staged --quiet || git commit -m "sync with hattipjs/hattip ${{ github.sha }}"
# Use the GIT_PUSH_KEY secret deploy key
if [ git diff --quiet && git diff --staged --quiet ]; then
echo "No changes to commit"
exit 0
fi
git commit -m "sync with hattipjs/hattip ${{ github.sha }}"
git tag v${{ github.event.inputs.version }}"
eval "$(ssh-agent -s)"
ssh-add - <<< "${{ secrets.GIT_PUSH_KEY }}"
ssh-add -l
# Set an SSH remote
git remote set-url origin [email protected]:hattipjs/deno-release.git
git push
git push --tags
19 changes: 18 additions & 1 deletion deno-build/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
readdirSync,
rmSync,
writeFileSync,
copyFileSync,
} from "node:fs";
import { basename, dirname, resolve } from "node:path";
import { replace } from "./replace.js";
Expand Down Expand Up @@ -57,6 +58,8 @@ const toBeCompiled = new Map<string, string>();
run();

function run() {
rmSync(resolve(rootDir, "_deno/src"), { recursive: true, force: true });

const packagesDir = resolve(rootDir, "packages");
const packages = readdirSync(packagesDir, { withFileTypes: true });
for (const pkg of packages) {
Expand All @@ -65,11 +68,19 @@ function run() {
}
}

rmSync(resolve(rootDir, "_deno/src"), { recursive: true, force: true });
for (const [name, path] of toBeCompiled) {
compile(name, path);
}

copyFileSync(
resolve(rootDir, "readme.md"),
resolve(rootDir, "_deno/src/readme.md"),
);
copyFileSync(
resolve(rootDir, "LICENSE"),
resolve(rootDir, "_deno/src/LICENSE"),
);

const { version } = JSON.parse(
readFileSync(resolve(rootDir, "packages/base/core/package.json"), "utf8"),
);
Expand Down Expand Up @@ -112,6 +123,12 @@ function processPackage(dir: string) {
return;
}

mkdirSync(resolve(rootDir, "_deno/src", packageName), { recursive: true });
copyFileSync(
resolve(dir, "readme.md"),
resolve(rootDir, "_deno/src", packageName, "readme.md"),
);

const exports = packageJson.exports;
let files: string[];

Expand Down

0 comments on commit 9984d8e

Please sign in to comment.