Skip to content

Commit 1678343

Browse files
committed
feat: gcp auto-release
1 parent 61d4d3a commit 1678343

File tree

4 files changed

+65
-15
lines changed

4 files changed

+65
-15
lines changed

.changeset/rich-suns-look.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
2-
"@calycode/core": minor
3-
"@calycode/cli": minor
2+
'@calycode/core': minor
3+
'@calycode/cli': minor
44
---
55

6-
refactor: rebrand actually, renamed the core package from caly-core to core and the command from caly-xano to simply xano
6+
docs: integrated docsify.js to auto-generate documentation site from command signatures.
7+
feat: added GCP uploader actions to the release to automatically update the docs on new release from the command signature
78
feat: added more descriptive and styled mardkown as docs that are generated from command signatures
8-
docs: integrated docsify.js to auto-generate documentation site from command signatures.
9+
refactor: rebrand actually, renamed the core package from caly-core to core and the command from caly-xano to simply xano
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Generate Docs
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
branches:
7+
- main
8+
9+
jobs:
10+
generate-docs:
11+
if: github.actor == 'github-actions[bot]'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
token: ${{ secrets.CHANGESETS_GH_TOKEN }}
17+
18+
- uses: pnpm/action-setup@v4
19+
with:
20+
version: 10
21+
run_install: true
22+
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 20.x
26+
27+
- run: pnpm install
28+
29+
- name: Build Docs
30+
run: pnpm docs:build
31+
32+
- name: Commit and push docs
33+
run: |
34+
git config user.name "github-actions[bot]"
35+
git config user.email "github-actions[bot]@users.noreply.github.com"
36+
git add docs
37+
git commit -m "chore: update docs [skip ci]" || echo "No changes to commit"
38+
git push

.github/workflows/release.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
name: Release Caly-Xano CLI
2-
1+
# .github/workflows/release.yml
32
on:
43
push:
54
branches:
65
- main
76

87
jobs:
98
release:
10-
name: Release CLI
119
runs-on: ubuntu-latest
1210
steps:
1311
- name: Checkout repo
@@ -18,25 +16,38 @@ jobs:
1816
with:
1917
version: 10
2018
run_install: true
21-
19+
2220
- name: Setup Node
2321
uses: actions/setup-node@v4
2422
with:
2523
node-version: 20.x
2624
registry-url: 'https://registry.npmjs.org'
2725
scope: '@calycode'
2826
always-auth: true
29-
env:
27+
env:
3028
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
31-
29+
3230
- name: Install dependencies
3331
run: pnpm install
34-
35-
- name: Create Release Pull Request or Publish to npm
32+
33+
- name: Publish to npm
3634
id: changesets
3735
uses: changesets/action@v1
3836
with:
3937
publish: pnpm -r publish --access restricted
4038
env:
4139
GITHUB_TOKEN: ${{ secrets.CHANGESETS_GH_TOKEN }}
4240
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
42+
# Upload docs to GCP ONLY after publishing
43+
- name: Authenticate GCP
44+
if: steps.changesets.outputs.published == 'true'
45+
uses: google-github-actions/auth@v3
46+
with:
47+
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
48+
49+
- name: Upload docs folder to GCP
50+
uses: google-github-actions/upload-cloud-storage@v3
51+
with:
52+
path: 'docs'
53+
destination: 'calycode.com/cli'

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
],
1212
"scripts": {
1313
"build": "tsc --build",
14+
"build:docs": "tsx scripts/generate-caly-cli-docs.ts",
1415
"build:packages": "pnpm -r --reporter=silent --workspace-concurrency=1 run build",
1516
"caly": "pnpm --filter @calycode/cli run caly",
16-
"update-caly-docs": "tsx scripts/generate-caly-cli-docs.ts",
17-
"serve-registry": "npx serve registry --listen 3030",
1817
"clean": "pnpm -r run clean && trash dist tsconfig.tsbuildinfo",
19-
"prepublishOnly": "pnpm run build:packages"
18+
"prepublishOnly": "pnpm run build:packages",
19+
"serve-registry": "npx serve registry --listen 3030"
2020
},
2121
"private": true,
2222
"publishConfig": {

0 commit comments

Comments
 (0)