genlayer 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/cli-docs.yml +121 -0
- package/.github/workflows/publish.yml +2 -0
- package/CHANGELOG.md +12 -0
- package/dist/index.js +6139 -2500
- package/package.json +4 -3
- package/scripts/generate-cli-docs.mjs +246 -0
- package/src/commands/contracts/code.ts +33 -0
- package/src/commands/contracts/index.ts +10 -0
- package/tests/actions/code.test.ts +87 -0
- package/tests/commands/code.test.ts +69 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
name: Generate CLI Docs and PR to genlayer-docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
generate-and-sync:
|
|
10
|
+
# Skip for pre-releases (tags containing '-') unless manually dispatched
|
|
11
|
+
if: github.event_name != 'release' || !contains(github.event.release.tag_name, '-')
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout CLI repo
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '20'
|
|
23
|
+
cache: 'npm'
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm ci
|
|
27
|
+
|
|
28
|
+
- name: Build
|
|
29
|
+
run: npm run build
|
|
30
|
+
|
|
31
|
+
- name: Determine version for docs
|
|
32
|
+
id: version
|
|
33
|
+
run: |
|
|
34
|
+
if [ "${{ github.event_name }}" = "release" ]; then
|
|
35
|
+
echo "value=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
|
|
36
|
+
else
|
|
37
|
+
# Prefer package.json version when not a release event
|
|
38
|
+
echo "value=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
- name: Generate CLI docs (MDX)
|
|
42
|
+
env:
|
|
43
|
+
DOCS_CLEAN: 'true'
|
|
44
|
+
DOCS_VERSION: ${{ steps.version.outputs.value }}
|
|
45
|
+
run: node scripts/generate-cli-docs.mjs | cat
|
|
46
|
+
|
|
47
|
+
- name: Set up Git (for committing to CLI repo)
|
|
48
|
+
run: |
|
|
49
|
+
git config user.name "github-actions[bot]"
|
|
50
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
51
|
+
|
|
52
|
+
- name: Commit and push docs back to CLI repo (non-beta releases)
|
|
53
|
+
if: github.event_name == 'release' && !contains(github.event.release.tag_name, '-')
|
|
54
|
+
run: |
|
|
55
|
+
set -euo pipefail
|
|
56
|
+
if [ -n "$(git status --porcelain docs/api-references || true)" ]; then
|
|
57
|
+
git add docs/api-references
|
|
58
|
+
VERSION=${{ steps.version.outputs.value }}
|
|
59
|
+
git commit -m "docs(cli): update API reference for ${VERSION}"
|
|
60
|
+
git push
|
|
61
|
+
else
|
|
62
|
+
echo "No docs changes to commit"
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
- name: Checkout docs repo
|
|
66
|
+
uses: actions/checkout@v4
|
|
67
|
+
with:
|
|
68
|
+
repository: genlayerlabs/genlayer-docs
|
|
69
|
+
token: ${{ secrets.DOCS_REPO_TOKEN || secrets.GITHUB_TOKEN }}
|
|
70
|
+
path: docs-repo
|
|
71
|
+
fetch-depth: 0
|
|
72
|
+
|
|
73
|
+
- name: Prepare branch
|
|
74
|
+
working-directory: docs-repo
|
|
75
|
+
run: |
|
|
76
|
+
set -euo pipefail
|
|
77
|
+
git config user.name "github-actions[bot]"
|
|
78
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
79
|
+
BRANCH="docs/cli/${{ github.repository }}-${{ github.ref_name }}-${{ github.run_id }}"
|
|
80
|
+
git switch -c "$BRANCH" || git switch "$BRANCH"
|
|
81
|
+
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
|
82
|
+
|
|
83
|
+
- name: Sync CLI docs into docs repo
|
|
84
|
+
run: |
|
|
85
|
+
set -euo pipefail
|
|
86
|
+
mkdir -p docs-repo/pages/api-references/genlayer-cli
|
|
87
|
+
rsync -a --delete "${{ github.workspace }}/docs/api-references/" docs-repo/pages/api-references/genlayer-cli/
|
|
88
|
+
echo "Synced files:" && ls -la docs-repo/pages/api-references/genlayer-cli | cat
|
|
89
|
+
|
|
90
|
+
- name: Commit changes
|
|
91
|
+
working-directory: docs-repo
|
|
92
|
+
run: |
|
|
93
|
+
set -euo pipefail
|
|
94
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
95
|
+
git add pages/api-references/genlayer-cli
|
|
96
|
+
git commit -m "docs(cli): sync API reference ${VERSION:-${{ env.VERSION }}}"
|
|
97
|
+
git push --set-upstream origin "$BRANCH"
|
|
98
|
+
echo "HAS_CHANGES=true" >> $GITHUB_ENV
|
|
99
|
+
else
|
|
100
|
+
echo "No changes to commit"
|
|
101
|
+
echo "HAS_CHANGES=false" >> $GITHUB_ENV
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
- name: Create PR in docs repo
|
|
105
|
+
if: env.HAS_CHANGES == 'true'
|
|
106
|
+
uses: peter-evans/create-pull-request@v6
|
|
107
|
+
with:
|
|
108
|
+
token: ${{ secrets.DOCS_REPO_TOKEN || secrets.GITHUB_TOKEN }}
|
|
109
|
+
path: docs-repo
|
|
110
|
+
commit-message: "docs(cli): sync API reference ${{ steps.version.outputs.value }}"
|
|
111
|
+
branch: ${{ env.BRANCH }}
|
|
112
|
+
title: "docs(cli): sync CLI API reference ${{ steps.version.outputs.value }}"
|
|
113
|
+
body: |
|
|
114
|
+
This PR updates the GenlayerCLI API Reference generated automatically from `${{ github.repository }}`.
|
|
115
|
+
|
|
116
|
+
- Version: `${{ steps.version.outputs.value }}`
|
|
117
|
+
- Source commit: `${{ github.sha }}`
|
|
118
|
+
- Trigger: `${{ github.event_name }}`
|
|
119
|
+
labels: documentation, cli
|
|
120
|
+
|
|
121
|
+
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.31.0 (2025-09-03)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* get contract code new cli command ([#253](https://github.com/yeagerai/genlayer-cli/issues/253)) ([d6ea30d](https://github.com/yeagerai/genlayer-cli/commit/d6ea30d96e2453fb90bd1493266d8b54c04e830b))
|
|
8
|
+
|
|
9
|
+
## 0.30.0 (2025-09-03)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* genlayercli api reference auto generated ([#247](https://github.com/yeagerai/genlayer-cli/issues/247)) ([b08c342](https://github.com/yeagerai/genlayer-cli/commit/b08c34218b9f02a1d8d7f1c0b532ab55cc4ca5af))
|
|
14
|
+
|
|
3
15
|
## 0.29.0 (2025-09-03)
|
|
4
16
|
|
|
5
17
|
### Features
|