Skip to content

Commit d01066e

Browse files
committed
wip
1 parent 202820a commit d01066e

File tree

3 files changed

+287
-0
lines changed

3 files changed

+287
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build and Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
7+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
8+
permissions:
9+
contents: write
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
build-and-deploy:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '18'
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Lint code
30+
run: npm run lint
31+
32+
- name: Run tests
33+
run: npm test
34+
35+
- name: Build library
36+
run: npm run build
37+
38+
- name: Deploy to GitHub Pages
39+
uses: peaceiris/actions-gh-pages@v3
40+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
41+
with:
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
publish_dir: ./
44+
publish_branch: gh-pages
45+
exclude_assets: |
46+
node_modules/
47+
src/
48+
tests/
49+
scripts/
50+
.github/
51+
package*.json
52+
rollup.config.js
53+
jest.config.js
54+
.eslintrc.js
55+
.gitignore
56+
PROJECT-STATUS.md
57+
PERFORMANCE-CLEANUP.md
58+
LLMS-IMPLEMENTATION.md
59+
# Explicitly include important files
60+
include_assets: |
61+
dist/
62+
examples/
63+
index.html
64+
README.md
65+
llms.txt
66+
.nojekyll
67+
_config.yml
68+
robots.txt

.github/workflows/pages.yml.backup

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
16+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: false
20+
21+
jobs:
22+
# Build job
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: '18'
33+
cache: 'npm'
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Lint code
39+
run: npm run lint
40+
41+
- name: Run tests
42+
run: npm test
43+
44+
- name: Build library
45+
run: npm run build
46+
47+
- name: Create deployment directory
48+
run: |
49+
mkdir -p _site
50+
cp -r dist/ _site/dist/
51+
cp -r examples/ _site/examples/
52+
cp index.html _site/
53+
cp README.md _site/
54+
cp llms.txt _site/
55+
cp robots.txt _site/
56+
cp .nojekyll _site/
57+
cp _config.yml _site/
58+
59+
- name: Setup Pages
60+
uses: actions/configure-pages@v4
61+
62+
- name: Upload artifact
63+
uses: actions/upload-pages-artifact@v3
64+
with:
65+
# Upload only the deployment files
66+
path: '_site'
67+
68+
# Deployment job
69+
deploy:
70+
environment:
71+
name: MicroUI Website
72+
url: ${{ steps.deployment.outputs.page_url }}
73+
runs-on: ubuntu-latest
74+
needs: build
75+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
76+
steps:
77+
- name: Deploy to GitHub Pages
78+
id: deployment
79+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on version tags like v1.0.0, v1.2.3, etc.
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '18'
22+
cache: 'npm'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Run tests
29+
run: npm test
30+
31+
- name: Build library
32+
run: npm run build
33+
34+
- name: Get version from tag
35+
id: get_version
36+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
37+
38+
- name: Create release notes
39+
id: release_notes
40+
run: |
41+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_OUTPUT
42+
echo "## 🚀 MicroUI v${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
43+
echo "" >> $GITHUB_OUTPUT
44+
echo "### 📦 Assets" >> $GITHUB_OUTPUT
45+
echo "- **microui.js** (${$(stat -f%z dist/microui.js | numfmt --to=iec)}B) - Development build with source maps" >> $GITHUB_OUTPUT
46+
echo "- **microui.min.js** (${$(stat -f%z dist/microui.min.js | numfmt --to=iec)}B) - Production build, minified" >> $GITHUB_OUTPUT
47+
echo "- **microui.esm.js** (${$(stat -f%z dist/microui.esm.js | numfmt --to=iec)}B) - ES modules build" >> $GITHUB_OUTPUT
48+
echo "" >> $GITHUB_OUTPUT
49+
echo "### 📊 Bundle Analysis" >> $GITHUB_OUTPUT
50+
echo "\`\`\`" >> $GITHUB_OUTPUT
51+
echo "Minified: $(stat -f%z dist/microui.min.js | numfmt --to=iec)B" >> $GITHUB_OUTPUT
52+
echo "Gzipped: $(gzip -c dist/microui.min.js | wc -c | numfmt --to=iec)B" >> $GITHUB_OUTPUT
53+
echo "\`\`\`" >> $GITHUB_OUTPUT
54+
echo "" >> $GITHUB_OUTPUT
55+
echo "### 🔗 Links" >> $GITHUB_OUTPUT
56+
echo "- 📚 [Documentation](https://lam0819.github.io/MicroUI/)" >> $GITHUB_OUTPUT
57+
echo "- 🎮 [Live Examples](https://lam0819.github.io/MicroUI/examples/)" >> $GITHUB_OUTPUT
58+
echo "- 📋 [API Reference](https://lam0819.github.io/MicroUI/#api-reference)" >> $GITHUB_OUTPUT
59+
echo "- 🤖 [LLMs.txt](https://lam0819.github.io/MicroUI/llms.txt)" >> $GITHUB_OUTPUT
60+
echo "" >> $GITHUB_OUTPUT
61+
echo "### 📥 Installation" >> $GITHUB_OUTPUT
62+
echo "\`\`\`bash" >> $GITHUB_OUTPUT
63+
echo "# NPM" >> $GITHUB_OUTPUT
64+
echo "npm install microui@${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
65+
echo "" >> $GITHUB_OUTPUT
66+
echo "# CDN" >> $GITHUB_OUTPUT
67+
echo "<script src=\"https://unpkg.com/microui@${{ steps.get_version.outputs.VERSION }}/dist/microui.min.js\"></script>" >> $GITHUB_OUTPUT
68+
echo "\`\`\`" >> $GITHUB_OUTPUT
69+
echo "EOF" >> $GITHUB_OUTPUT
70+
71+
- name: Create ZIP archive
72+
run: |
73+
mkdir -p release-assets
74+
cp dist/microui.js release-assets/
75+
cp dist/microui.min.js release-assets/
76+
cp dist/microui.esm.js release-assets/
77+
cp README.md release-assets/
78+
cp LICENSE release-assets/
79+
cp package.json release-assets/
80+
cd release-assets
81+
zip -r ../microui-v${{ steps.get_version.outputs.VERSION }}.zip .
82+
cd ..
83+
84+
- name: Create GitHub Release
85+
id: create_release
86+
uses: actions/create-release@v1
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
tag_name: ${{ github.ref }}
91+
release_name: MicroUI v${{ steps.get_version.outputs.VERSION }}
92+
body: ${{ steps.release_notes.outputs.RELEASE_NOTES }}
93+
draft: false
94+
prerelease: false
95+
96+
- name: Upload Development Build
97+
uses: actions/upload-release-asset@v1
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
with:
101+
upload_url: ${{ steps.create_release.outputs.upload_url }}
102+
asset_path: ./dist/microui.js
103+
asset_name: microui.js
104+
asset_content_type: application/javascript
105+
106+
- name: Upload Production Build
107+
uses: actions/upload-release-asset@v1
108+
env:
109+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
with:
111+
upload_url: ${{ steps.create_release.outputs.upload_url }}
112+
asset_path: ./dist/microui.min.js
113+
asset_name: microui.min.js
114+
asset_content_type: application/javascript
115+
116+
- name: Upload ES Modules Build
117+
uses: actions/upload-release-asset@v1
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
with:
121+
upload_url: ${{ steps.create_release.outputs.upload_url }}
122+
asset_path: ./dist/microui.esm.js
123+
asset_name: microui.esm.js
124+
asset_content_type: application/javascript
125+
126+
- name: Upload ZIP Archive
127+
uses: actions/upload-release-asset@v1
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
with:
131+
upload_url: ${{ steps.create_release.outputs.upload_url }}
132+
asset_path: ./microui-v${{ steps.get_version.outputs.VERSION }}.zip
133+
asset_name: microui-v${{ steps.get_version.outputs.VERSION }}.zip
134+
asset_content_type: application/zip
135+
136+
# Uncomment to publish to NPM automatically
137+
# - name: Publish to NPM
138+
# run: npm publish
139+
# env:
140+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)