Skip to content

Commit a8b6bd3

Browse files
committed
ci: add release and deployment workflows
1 parent e7bf155 commit a8b6bd3

File tree

12 files changed

+307
-3
lines changed

12 files changed

+307
-3
lines changed

.github/actions/setup/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Setup
2+
description: Installs Node, enables Corepack, and caches pnpm.
3+
4+
runs:
5+
using: composite
6+
7+
steps:
8+
- name: Use Latest Corepack
9+
shell: bash
10+
run: |
11+
echo "Before: corepack version => $(corepack --version || echo 'not installed')"
12+
npm i -g corepack@latest
13+
echo "After : corepack version => $(corepack --version)"
14+
corepack enable
15+
pnpm --version || true
16+
17+
- name: Setup node & pnpm
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: lts/*
21+
cache: pnpm
22+
registry-url: https://registry.npmjs.org
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy registry
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'apps/registry/**'
9+
- 'packages/elements/**'
10+
- 'packages/examples/**'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
deployments: write
16+
17+
jobs:
18+
deploy:
19+
runs-on: ubuntu-latest
20+
name: Publish registry (Nitro) to Cloudflare Workers
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup (Install Node & pnpm)
26+
uses: ./.github/actions/setup
27+
28+
- name: Install dependencies
29+
run: pnpm i --frozen-lockfile
30+
31+
- name: Build registry (Nitro Cloudflare Worker)
32+
run: pnpm --filter ./apps/registry build
33+
34+
- name: Publish to Cloudflare Workers via Wrangler
35+
working-directory: apps/registry
36+
env:
37+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
38+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
39+
run: |
40+
npx wrangler@4 deploy --config wrangler.toml

.github/workflows/deploy-www.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy www
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'apps/www/**'
9+
- 'packages/elements/**'
10+
- 'packages/examples/**'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: write
15+
deployments: write
16+
pull-requests: write
17+
18+
jobs:
19+
deploy:
20+
runs-on: ubuntu-latest
21+
name: Publish www (Nuxt SSR) to Cloudflare Workers
22+
concurrency:
23+
group: deploy-www-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Setup (Install Node & pnpm)
31+
uses: ./.github/actions/setup
32+
33+
- name: Install dependencies
34+
run: pnpm i --frozen-lockfile
35+
36+
- name: Build www
37+
env:
38+
NODE_OPTIONS: --max-old-space-size=6144
39+
run: pnpm build:www
40+
41+
- name: Publish to Cloudflare Workers via Wrangler
42+
working-directory: apps/www
43+
env:
44+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
45+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
46+
run: |
47+
npx wrangler@4 deploy --config wrangler.toml

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup (Install Node & pnpm)
20+
uses: ./.github/actions/setup
21+
22+
- name: Install dependencies
23+
run: pnpm i --frozen-lockfile
24+
25+
- name: Generate GitHub Release notes
26+
run: pnpm dlx changelogithub
27+
env:
28+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
29+
30+
- name: Configure npm auth
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: lts/*
34+
registry-url: 'https://registry.npmjs.org'
35+
36+
- name: Publish packages/registry to npm
37+
env:
38+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
run: pnpm --filter ./packages/registry publish --access public --no-git-checks

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ AI Elements Vue includes the following components:
100100

101101
## How It Works
102102

103-
The AI Elements CLI:
103+
The AI Elements Vue CLI:
104104

105105
1. **Detects your package manager** (npm, pnpm, yarn, or bun) automatically
106106
2. **Fetches component registry** from `https://registry.ai-elements-vue.com/all.json`

apps/registry/nitro.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export default defineNitroConfig({
55
compatibilityDate: 'latest',
66
srcDir: 'server',
77
imports: false,
8+
preset: 'cloudflare',
89
})

apps/registry/wrangler.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name = "ai-elements-vue"
2+
main = ".output/server/index.mjs"
3+
compatibility_date = "2024-07-06"
4+
5+
[vars]
6+
# Add environment variables here if needed, e.g. API keys
7+
8+
routes = [ "registry.ai-elements-vue.com/*" ]

apps/test/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "test",
33
"type": "module",
4+
"version": "0.0.0",
45
"private": true,
56
"scripts": {
67
"build": "nuxt build",

apps/www/nuxt.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@ export default defineNuxtConfig({
4141
},
4242

4343
compatibilityDate: '2024-07-06',
44+
nitro: {
45+
preset: 'cloudflare-pages',
46+
},
4447
})

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
"scripts": {
99
"build": "turbo run build",
1010
"dev": "turbo run dev",
11+
"dev:www": "pnpm --filter www dev",
12+
"build:www": "pnpm --filter www build",
13+
"preview:www": "pnpm --filter www preview",
14+
"dev:test": "pnpm --filter test dev",
15+
"dev:registry": "pnpm --filter registry dev",
16+
"build:registry": "pnpm --filter registry build",
1117
"prepare": "pnpm simple-git-hooks",
1218
"lint": "eslint . && turbo run lint",
1319
"lint:fix": "eslint . --fix",

0 commit comments

Comments
 (0)