Skip to content
This repository was archived by the owner on Apr 20, 2025. It is now read-only.

Commit 3aec766

Browse files
authored
Merge pull request #15 from BonyChops/feat/cicd
Feat/cicd
2 parents 8d9629a + 1af8cf8 commit 3aec766

File tree

9 files changed

+738
-37
lines changed

9 files changed

+738
-37
lines changed

.github/workflows/build-check.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
on:
3+
workflow_call: # 他のワークフローから呼び出せるようにする
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
strategy:
11+
matrix:
12+
runtime: ['node', 'bun']
13+
include:
14+
- runtime: 'node'
15+
setup: 'actions/setup-node@v4'
16+
version: '20.x'
17+
- runtime: 'bun'
18+
setup: 'oven-sh/setup-bun@v1'
19+
version: 'latest'
20+
steps:
21+
- uses: actions/checkout@v4
22+
# Setup runtime environment (Node.js or Bun)
23+
24+
- name: Setup Node.js
25+
if: matrix.runtime == 'node'
26+
uses: actions/setup-node@v4
27+
with:
28+
version: '20.x'
29+
registry-url: 'https://registry.npmjs.org'
30+
31+
- name: Setup Bun
32+
if: matrix.runtime == 'bun'
33+
uses: oven-sh/setup-bun@v1
34+
with:
35+
version: 'latest'
36+
37+
38+
# Install dependencies and build
39+
- name: Install with npm
40+
if: matrix.runtime == 'node'
41+
run: npm ci
42+
- name: Install with bun
43+
if: matrix.runtime == 'bun'
44+
run: bun install
45+
# Build step
46+
- name: Build with npm
47+
if: matrix.runtime == 'node'
48+
run: npm run build
49+
- name: Build with bun
50+
if: matrix.runtime == 'bun'
51+
run: bun run build

.github/workflows/pr.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: PR CI
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
ci:
7+
uses: ./.github/workflows/build-check.yml
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Package to npmjs
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
# まずは共通CIワークフローを呼び出す!
7+
build-check:
8+
uses: ./.github/workflows/build-check.yml
9+
10+
# CIが終わったらnpmにパブリッシュするよ!
11+
publish:
12+
needs: build-check # CIが成功した後に実行
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
id-token: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: '20.x'
22+
registry-url: 'https://registry.npmjs.org'
23+
- run: npm ci
24+
- run: npm run build
25+
- run: npm publish --provenance --access public
26+
env:
27+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tsconfig.json
2+
mise.toml
3+
.prettierrc
4+
.eslintrc.json
5+
src/
6+
bin/
7+
.vscode/
8+
.github/

bun.lock

Lines changed: 611 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mise.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tools]
2+
node = "22"

package-lock.json

Lines changed: 28 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@
3838
"version": "1.1.0",
3939
"main": "bin/fetch-kosen-syllabus",
4040
"scripts": {
41+
"dev": "ts-node ./bin/fetch-kosen-syllabus.ts",
4142
"test": "npm run format:check && npm run lint",
4243
"build": "tsc",
4344
"prepublish": "npm run format:fix && npm run lint & npm run build",
44-
"format:check": "prettier --check ./bin ./src",
45-
"format:fix": "prettier --write ./bin ./src",
46-
"lint": "eslint ./bin ./src"
45+
"format:check": "prettier --check ./src",
46+
"format:fix": "prettier --write ./src",
47+
"lint": "eslint ./src/**"
4748
},
4849
"bin": {
4950
"fetch-kosen-syllabus": "dist/bin/fetch-kosen-syllabus.js"

test.js

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

0 commit comments

Comments
 (0)