Skip to content

Commit 90fc698

Browse files
committed
chore: changed publish process
1 parent 35fb2c4 commit 90fc698

File tree

5 files changed

+152
-79
lines changed

5 files changed

+152
-79
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
lint-and-format:
11+
name: Lint and Format Check
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Bun
19+
uses: oven-sh/setup-bun@v2
20+
with:
21+
bun-version: latest
22+
23+
- name: Install dependencies
24+
run: bun install --frozen-lockfile
25+
26+
- name: Run ESLint
27+
run: bun run lint
28+
29+
- name: Check formatting with Prettier
30+
run: bun run format:check
31+
32+
build:
33+
name: Build
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
40+
- name: Setup Bun
41+
uses: oven-sh/setup-bun@v2
42+
with:
43+
bun-version: latest
44+
45+
- name: Install dependencies
46+
run: bun install --frozen-lockfile
47+
48+
- name: Build project
49+
run: bun run build
50+
51+
- name: Upload build artifact
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: dist
55+
path: dist/
56+
retention-days: 7

.github/workflows/publish.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
12+
jobs:
13+
release:
14+
name: Build and Publish to npm
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Bun
22+
uses: oven-sh/setup-bun@v2
23+
with:
24+
bun-version: latest
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
registry-url: 'https://registry.npmjs.org'
31+
32+
- name: Install dependencies
33+
run: bun install --frozen-lockfile
34+
35+
- name: Run linter
36+
run: bun run lint
37+
38+
- name: Check formatting
39+
run: bun run format:check
40+
41+
- name: Build project
42+
run: bun run build
43+
44+
- name: Extract version and commit info
45+
id: get_info
46+
run: |
47+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
48+
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
49+
echo "COMMIT_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
50+
echo "COMMIT_FULL=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
51+
52+
- name: Create release archive
53+
run: |
54+
cd dist
55+
zip void-${{ steps.get_info.outputs.TAG }}-${{ steps.get_info.outputs.COMMIT_SHORT }}.zip index.js
56+
cd ..
57+
58+
- name: Update package.json version
59+
run: |
60+
npm version ${{ steps.get_info.outputs.VERSION }} --no-git-tag-version
61+
62+
- name: Publish to npm with provenance
63+
run: npm publish --provenance --access public
64+
env:
65+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
67+
- name: Create GitHub Release
68+
uses: softprops/action-gh-release@v2
69+
with:
70+
files: |
71+
dist/broom-${{ steps.get_info.outputs.TAG }}-${{ steps.get_info.outputs.COMMIT_SHORT }}.zip
72+
generate_release_notes: true
73+
draft: false
74+
prerelease: false
75+
body: |
76+
## Installation
77+
78+
```bash
79+
npm install -g @tukuyomil032/broom@${{ steps.get_info.outputs.VERSION }}
80+
```
81+
82+
## Download
83+
84+
Download the pre-built binary:
85+
- `broom-${{ steps.get_info.outputs.TAG }}-${{ steps.get_info.outputs.COMMIT_SHORT }}.zip`
86+
87+
**Commit**: `${{ steps.get_info.outputs.COMMIT_FULL }}`
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
"url": "https://github.com/tukuyomil032/broom/issues"
4545
},
4646
"homepage": "https://github.com/tukuyomil032/broom#readme",
47+
"engines": {
48+
"node": ">=18.0.0"
49+
},
50+
"os": [
51+
"darwin"
52+
],
4753
"dependencies": {
4854
"@inquirer/prompts": "^8.2.0",
4955
"@types/handlebars": "^4.1.0",

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"module": "ESNext",
55
"lib": ["ES2020"],
66
"outDir": "./dist",
7-
"rootDir": "./src",
7+
"rootDir": "./",
88
"strict": true,
99
"esModuleInterop": true,
1010
"skipLibCheck": true,

0 commit comments

Comments
 (0)