Skip to content

Commit 6c4100f

Browse files
committed
modified site and npm deployment scripts
Signed-off-by: Alok Ranjan Daftuar <aloknecessary@gmail.com> branch updated for demo deployment under gh-pages permission fixed modified site and npm deployment scripts
1 parent c4cd5c2 commit 6c4100f

10 files changed

Lines changed: 171 additions & 409 deletions

File tree

.env

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

.github/workflows/deploy-storybook.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy Site + Storybook
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: npm
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
# 1️⃣ Build Storybook under /demo
31+
- name: Build Storybook
32+
run: npm run build-storybook
33+
env:
34+
STORYBOOK_BASE_PATH: /${{ github.event.repository.name }}/demo/
35+
36+
# 2️⃣ Create landing page from README
37+
- name: Generate landing page
38+
run: |
39+
npx marked README.md > index.html
40+
41+
# 3️⃣ Prepare final deploy folder
42+
- name: Prepare deploy folder
43+
run: |
44+
mkdir site
45+
mv index.html site/
46+
cp -r docs site/docs
47+
mv storybook-static site/demo
48+
49+
# 4️⃣ Upload artifact
50+
- name: Upload Pages artifact
51+
uses: actions/upload-pages-artifact@v4
52+
with:
53+
path: ./site
54+
55+
deploy:
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
60+
runs-on: ubuntu-latest
61+
needs: build
62+
63+
steps:
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

.github/workflows/npm-publish.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
concurrency:
9+
group: npm-publish
10+
cancel-in-progress: false
11+
12+
jobs:
13+
publish:
14+
if: github.ref_type == 'tag'
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: write # required for GitHub Release
19+
id-token: write # required for npm provenance
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
registry-url: "https://registry.npmjs.org"
30+
cache: npm
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
env:
35+
NODE_ENV: development # ensure devDependencies are installed
36+
37+
# - name: Run lint (optional but recommended)
38+
# run: npm run lint --if-present
39+
40+
# - name: Run tests
41+
# run: npm test --if-present
42+
43+
- name: Build package
44+
run: npm run compile
45+
env:
46+
NODE_ENV: production # explicitly production during build
47+
48+
- name: Validate version matches tag
49+
run: |
50+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
51+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
52+
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
53+
echo "Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)"
54+
exit 1
55+
fi
56+
57+
- name: Ensure package does not already exist
58+
run: |
59+
PACKAGE_NAME=$(node -p "require('./package.json').name")
60+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
61+
if npm view "$PACKAGE_NAME@$PACKAGE_VERSION" > /dev/null 2>&1; then
62+
echo "Version already published."
63+
exit 1
64+
fi
65+
66+
- name: Validate package contents
67+
run: |
68+
npm pack
69+
tar -tf *.tgz
70+
71+
- name: Publish to npm
72+
run: npm publish --provenance --access public
73+
env:
74+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
75+
76+
- name: Create GitHub Release
77+
uses: softprops/action-gh-release@v2
78+
with:
79+
generate_release_notes: true

.github/workflows/publish-npm.yml

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ yarn-error.log*
2727
dist
2828
.env
2929
*.tgz
30+
.env

.storybook/main.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,16 @@ const config: StorybookConfig = {
1111
name: "@storybook/react-vite",
1212
options: {},
1313
},
14+
staticDirs: [],
15+
16+
async viteFinal(config) {
17+
const basePath = process.env.STORYBOOK_BASE_PATH;
18+
19+
// Default to root for local builds
20+
config.base = basePath ?? "/";
21+
22+
return config;
23+
},
1424
};
25+
1526
export default config;

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
<br/>
55
</p>
66

7-
# <p align="center">React Progress Stepper</p>
8-
### <p align="center">Minimal and beautiful stepper for React.</p>
7+
<h1 align="center">React Progress Stepper</h1>
8+
<h3 align="center">Minimal and beautiful stepper for React.</h3>
9+
910
<p align="center">
10-
<a href="https://aloknecessary.github.io/react-progress-stepper-ts"><img src="https://img.shields.io/badge/LIVE DEMO-23c275?style=flat"></a>
11+
<a href="https://aloknecessary.github.io/react-progress-stepper-ts/demo"><img src="https://img.shields.io/badge/LIVE DEMO-23c275?style=flat"></a>
1112
<img src="https://img.shields.io/badge/Open%20Source-🤍-23c275">
1213
<img src="https://img.shields.io/github/stars/aloknecessary/react-progress-stepper-ts?color=23c275&label=Stars">
1314
<img src="https://img.shields.io/npm/dw/react-progress-stepper-ts?color=23c275&label=Downloads">

0 commit comments

Comments
 (0)