Skip to content

Commit

Permalink
chore: use bun publish and fix generate changelog script
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Nov 30, 2024
1 parent 4da2702 commit dfacfe3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
fetch-depth: 0

- name: Install Bun
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.34

- id: changelog
name: Generate changelog
Expand All @@ -27,7 +29,7 @@ jobs:
run: bun install

- name: Prepare to JSR publish
run: bun scripts/prepare-jsr.ts
run: bun scripts/release-jsr.ts

- name: Type-check
run: tsc --noEmit
Expand All @@ -36,12 +38,19 @@ jobs:
uses: denoland/setup-deno@v1

- name: Publish package to JSR
run: deno publish --allow-dirty --unstable-sloppy-imports
run: deno publish --allow-dirty --unstable-sloppy-imports --allow-slow-types

# - name: Install Node
# uses: actions/setup-node@v4
# with:
# node-version: "20.x"
# registry-url: "https://registry.npmjs.org"
# scope: "@gramio"

- name: Publish package to NPM
run: npm publish --access public
run: bun publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: GitHub Release
uses: ncipollo/release-action@v1
Expand Down
7 changes: 5 additions & 2 deletions scripts/generate-changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@ function getLatestTag() {
try {
return execSync("git describe --abbrev=0 --tags").toString().trim();
} catch (e) {
if (e?.message.includes("No names found")) return;
console.warn(e);
return execSync("git rev-list --max-parents=0 HEAD").toString().trim();
}
}

const tag = getLatestTag();

const commits = execSync(
`git log ${getLatestTag()}..HEAD --pretty="format:%s%b"`,
`git log ${tag ? `${tag}..HEAD` : "HEAD"} --pretty="format:%s%b"`,
)
.toString()
.trim()
.split("\n")
.reverse();

console.log(getLatestTag(), commits);
console.log(tag, commits);

const version = execSync("npm pkg get version").toString().replace(/"/gi, "");

Expand Down

0 comments on commit dfacfe3

Please sign in to comment.