Skip to content

Commit e224de9

Browse files
committed
feat: setup project structure and CI workflows
- Add initial `src/index.ts` and `vitest.config.ts` - Configure GitHub Actions for testing, version bumping, and releases - Update repository URLs in `package.json`
1 parent fcbb191 commit e224de9

File tree

6 files changed

+155
-3
lines changed

6 files changed

+155
-3
lines changed

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup pnpm
17+
uses: pnpm/action-setup@v4
18+
with:
19+
version: 10.13.1
20+
run_install: false
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 18
26+
registry-url: 'https://registry.npmjs.org/'
27+
cache: 'pnpm'
28+
29+
- name: Install dependencies
30+
run: pnpm install
31+
32+
- name: Build package
33+
run: pnpm build
34+
35+
- name: Publish to npm
36+
run: pnpm publish --access public --no-git-checks
37+
env:
38+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
39+

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup pnpm
20+
uses: pnpm/action-setup@v4
21+
with:
22+
version: 10.13.1
23+
run_install: false
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '18'
29+
cache: 'pnpm'
30+
31+
- name: Install dependencies
32+
run: pnpm install --no-frozen-lockfile
33+
34+
- name: Run tests
35+
run: pnpm test
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Version Bump
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: 'Select version bump type'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
jobs:
17+
bump-version:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
fetch-depth: 0
25+
26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@v4
28+
with:
29+
version: 10.13.1
30+
run_install: false
31+
32+
- name: Set up Node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 18
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Generate new version
41+
id: version
42+
run: |
43+
NEW_VERSION=$(pnpm version ${{ inputs.release_type }} --no-git-tag-version | awk '{print $NF}')
44+
echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
45+
46+
- name: Create new branch
47+
run: |
48+
git checkout -b release/${{ env.new_version }}
49+
50+
- name: Commit & Push changes
51+
run: |
52+
git config user.name "github-actions[bot]"
53+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
54+
git add package.json pnpm-lock.yaml
55+
git commit -m "chore(release): bump version to ${{ env.new_version }}"
56+
git push origin release/${{ env.new_version }}
57+
58+
- name: Create Pull Request
59+
run: |
60+
gh pr create \
61+
--base main \
62+
--head release/${{ env.new_version }} \
63+
--title "Release: ${{ env.new_version }}" \
64+
--body "Auto-generated release PR for version ${{ env.new_version }}"
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Notify about Major Release (if major)
69+
if: inputs.release_type == 'major'
70+
run: |
71+
echo "🚨 Major version update detected! Please review and merge manually."

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
"license": "MIT",
3535
"repository": {
3636
"type": "git",
37-
"url": "git+https://github.com/taj54/interactive-video-react-wrapper.git"
37+
"url": "git+https://github.com/interactive-video-labs/interactive-video-react-wrapper.git"
3838
},
39-
"homepage": "https://github.com/taj54/interactive-video-react-wrapper#readme",
39+
"homepage": "https://github.com/interactive-video-labs/interactive-video-react-wrapper#readme",
4040
"bugs": {
41-
"url": "https://github.com/taj54/interactive-video-react-wrapper/issues"
41+
"url": "https://github.com/interactive-video-labs/interactive-video-react-wrapper/issues"
4242
},
4343
"packageManager": "[email protected]",
4444
"dependencies": {

src/index.ts

Whitespace-only changes.

vitest.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'vitest/config';
2+
3+
export default defineConfig({
4+
test: {
5+
environment: 'jsdom',
6+
},
7+
});

0 commit comments

Comments
 (0)