permaweb-deploy 2.5.0 → 2.5.2
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/LICENSE +21 -0
- package/README.md +419 -82
- package/bin/dev.js +5 -0
- package/bin/run.js +5 -0
- package/dist/commands/deploy.js +289 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/constants/flags.js +190 -0
- package/dist/constants/flags.js.map +1 -0
- package/dist/index.js +2 -299
- package/dist/index.js.map +1 -0
- package/dist/prompts/arns.js +89 -0
- package/dist/prompts/arns.js.map +1 -0
- package/dist/prompts/deployment.js +27 -0
- package/dist/prompts/deployment.js.map +1 -0
- package/dist/prompts/wallet.js +51 -0
- package/dist/prompts/wallet.js.map +1 -0
- package/dist/src/commands/deploy.d.ts +9 -0
- package/dist/src/commands/deploy.d.ts.map +1 -0
- package/dist/src/constants/flags.d.ts +84 -0
- package/dist/src/constants/flags.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/prompts/arns.d.ts +13 -0
- package/dist/src/prompts/arns.d.ts.map +1 -0
- package/dist/src/prompts/deployment.d.ts +6 -0
- package/dist/src/prompts/deployment.d.ts.map +1 -0
- package/dist/src/prompts/wallet.d.ts +11 -0
- package/dist/src/prompts/wallet.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +31 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/utils/__tests__/constants.test.d.ts +2 -0
- package/dist/src/utils/__tests__/constants.test.d.ts.map +1 -0
- package/dist/src/utils/config-resolver.d.ts +72 -0
- package/dist/src/utils/config-resolver.d.ts.map +1 -0
- package/dist/src/utils/constants.d.ts +4 -0
- package/dist/src/utils/constants.d.ts.map +1 -0
- package/dist/src/utils/path.d.ts +5 -0
- package/dist/src/utils/path.d.ts.map +1 -0
- package/dist/src/utils/signer.d.ts +17 -0
- package/dist/src/utils/signer.d.ts.map +1 -0
- package/dist/src/utils/uploader.d.ts +9 -0
- package/dist/src/utils/uploader.d.ts.map +1 -0
- package/dist/src/utils/validators.d.ts +29 -0
- package/dist/src/utils/validators.d.ts.map +1 -0
- package/dist/tests/constants.d.ts +11 -0
- package/dist/tests/constants.d.ts.map +1 -0
- package/dist/tests/e2e/deploy-command.test.d.ts +2 -0
- package/dist/tests/e2e/deploy-command.test.d.ts.map +1 -0
- package/dist/tests/global-setup.d.ts +6 -0
- package/dist/tests/global-setup.d.ts.map +1 -0
- package/dist/tests/mocks/turbo-handlers.d.ts +106 -0
- package/dist/tests/mocks/turbo-handlers.d.ts.map +1 -0
- package/dist/tests/setup.d.ts +11 -0
- package/dist/tests/setup.d.ts.map +1 -0
- package/dist/tests/types/payment-service.d.ts +218 -0
- package/dist/tests/types/payment-service.d.ts.map +1 -0
- package/dist/tests/types/upload-service.d.ts +168 -0
- package/dist/tests/types/upload-service.d.ts.map +1 -0
- package/dist/tests/unit/validators.test.d.ts +2 -0
- package/dist/tests/unit/validators.test.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/config-resolver.js +39 -0
- package/dist/utils/config-resolver.js.map +1 -0
- package/dist/utils/constants.js +6 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/path.js +15 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/signer.js +40 -0
- package/dist/utils/signer.js.map +1 -0
- package/dist/utils/uploader.js +87 -0
- package/dist/utils/uploader.js.map +1 -0
- package/dist/utils/validators.js +62 -0
- package/dist/utils/validators.js.map +1 -0
- package/package.json +107 -36
- package/.babelrc +0 -3
- package/.editorconfig +0 -4
- package/.eslintrc.js +0 -35
- package/dist/turbo/index.js +0 -234
- package/src/index.js +0 -287
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Forward Research
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
# Permaweb
|
|
1
|
+
# Permaweb Deploy
|
|
2
2
|
|
|
3
3
|
Inspired by the [cookbook github action deployment guide](https://cookbook.arweave.dev/guides/deployment/github-action.html), `permaweb-deploy` is a Node.js command-line tool designed to streamline the deployment of web applications to the permaweb using Arweave. It uploads your build folder or a single file, creates Arweave manifests, and updates ArNS (Arweave Name Service) records via ANT (Arweave Name Token) with the transaction ID.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
7
|
- **Turbo SDK Integration:** Uses Turbo SDK for fast, reliable file uploads to Arweave
|
|
8
|
+
- **On-Demand Payment:** Pay with ARIO or Base-ETH tokens on-demand during upload
|
|
8
9
|
- **Arweave Manifest v0.2.0:** Creates manifests with fallback support for SPAs
|
|
9
10
|
- **ArNS Updates:** Updates ArNS records via ANT with new transaction IDs and metadata
|
|
10
11
|
- **Automated Workflow:** Integrates with GitHub Actions for continuous deployment
|
|
@@ -12,28 +13,30 @@ Inspired by the [cookbook github action deployment guide](https://cookbook.arwea
|
|
|
12
13
|
- **404 Fallback Detection:** Automatically detects and sets 404.html as fallback
|
|
13
14
|
- **Network Support:** Supports mainnet, testnet, and custom ARIO process IDs
|
|
14
15
|
- **Flexible Deployment:** Supports deploying a folder or a single file
|
|
16
|
+
- **Modern CLI:** Built with oclif for a robust command-line experience
|
|
17
|
+
- **TypeScript:** Fully typed for better developer experience
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
## Installation
|
|
17
20
|
|
|
18
|
-
Install the package using
|
|
21
|
+
Install the package using pnpm (recommended):
|
|
19
22
|
|
|
20
23
|
```bash
|
|
21
|
-
|
|
24
|
+
pnpm add -D permaweb-deploy
|
|
22
25
|
```
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
Or with npm:
|
|
25
28
|
|
|
26
29
|
```bash
|
|
27
|
-
npm install
|
|
30
|
+
npm install --save-dev permaweb-deploy
|
|
28
31
|
```
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
Or with yarn:
|
|
31
34
|
|
|
32
35
|
```bash
|
|
33
|
-
yarn add
|
|
36
|
+
yarn add --dev permaweb-deploy
|
|
34
37
|
```
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
## Prerequisites
|
|
37
40
|
|
|
38
41
|
1. **For Arweave signer (default):** Encode your Arweave wallet key in base64 format and set it as a GitHub secret:
|
|
39
42
|
|
|
@@ -42,156 +45,490 @@ yarn add permaweb-deploy --dev --ignore-engines
|
|
|
42
45
|
```
|
|
43
46
|
|
|
44
47
|
2. **For Ethereum/Polygon/KYVE signers:** Use your raw private key (no encoding needed) as the `DEPLOY_KEY`.
|
|
45
|
-
|
|
46
48
|
3. Ensure that the secret name for the encoded wallet or private key is `DEPLOY_KEY`.
|
|
47
49
|
|
|
48
50
|
⚠️ **Important:** Use a dedicated wallet for deployments to minimize security risks. Ensure your wallet has sufficient Turbo Credits for uploads.
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
## Usage
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
### Interactive Mode (Easiest)
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
**Command Menu:**
|
|
57
|
+
|
|
58
|
+
Simply run the CLI for an interactive command selector:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
permaweb-deploy
|
|
62
|
+
# or explicitly
|
|
63
|
+
permaweb-deploy interactive
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This shows a menu with options:
|
|
67
|
+
|
|
68
|
+
- **Deploy to Permaweb** - Start the deployment wizard
|
|
69
|
+
- **Show Help** - Display help information
|
|
70
|
+
- **Exit** - Exit the CLI
|
|
71
|
+
|
|
72
|
+
**Interactive Deploy (Guided):**
|
|
73
|
+
|
|
74
|
+
Run the deploy command without arguments to be guided through all deployment options:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
permaweb-deploy deploy
|
|
59
78
|
```
|
|
60
79
|
|
|
61
|
-
|
|
80
|
+
This will prompt you for:
|
|
81
|
+
|
|
82
|
+
- ArNS name
|
|
83
|
+
- Wallet method (file, string, or environment variable)
|
|
84
|
+
- Signer type (Arweave, Ethereum, Polygon, KYVE)
|
|
85
|
+
- What to deploy (folder or file)
|
|
86
|
+
- Advanced options (optional: undername, TTL, network)
|
|
62
87
|
|
|
63
|
-
|
|
88
|
+
### Direct Commands
|
|
64
89
|
|
|
65
|
-
|
|
66
|
-
- `--ario-process, -p`: ARIO process to use (`mainnet`, `testnet`, or a custom process ID). Default: mainnet.
|
|
67
|
-
- `--deploy-folder, -d`: Folder to deploy. Default: `./dist`.
|
|
68
|
-
- `--deploy-file, -f`: Deploy a single file instead of a folder.
|
|
69
|
-
- `--undername, -u`: ANT undername to update. Default: `@`.
|
|
70
|
-
- `--ttl-seconds, -t`: TTL in seconds for the ANT record (60-86400). Default: `3600`.
|
|
71
|
-
- `--sig-type, -s`: Signer type for deployment. Choices: `arweave`, `ethereum`, `polygon`, `kyve`. Default: `arweave`.
|
|
72
|
-
- `--help`: Show all available options and usage examples.
|
|
73
|
-
- `--version`: Show the current version number.
|
|
90
|
+
Use flags for faster, scriptable deployments:
|
|
74
91
|
|
|
75
|
-
|
|
92
|
+
```bash
|
|
93
|
+
# Basic deployment with wallet file
|
|
94
|
+
permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json
|
|
95
|
+
```
|
|
76
96
|
|
|
77
|
-
Deploy
|
|
97
|
+
Deploy using private key directly:
|
|
78
98
|
|
|
79
|
-
```
|
|
80
|
-
|
|
99
|
+
```bash
|
|
100
|
+
permaweb-deploy deploy --arns-name my-app --private-key "$(cat wallet.json)"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Deploy using environment variable:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
DEPLOY_KEY=$(base64 -i wallet.json) permaweb-deploy deploy --arns-name my-app
|
|
81
107
|
```
|
|
82
108
|
|
|
83
109
|
Deploy a specific folder:
|
|
84
110
|
|
|
85
|
-
```
|
|
86
|
-
|
|
111
|
+
```bash
|
|
112
|
+
permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --deploy-folder ./build
|
|
87
113
|
```
|
|
88
114
|
|
|
89
115
|
Deploy a single file:
|
|
90
116
|
|
|
91
|
-
```
|
|
92
|
-
|
|
117
|
+
```bash
|
|
118
|
+
permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --deploy-file ./path/to/file.txt
|
|
93
119
|
```
|
|
94
120
|
|
|
95
|
-
|
|
121
|
+
### Advanced Usage
|
|
122
|
+
|
|
123
|
+
Deploy to an undername (subdomain):
|
|
96
124
|
|
|
97
|
-
```
|
|
98
|
-
|
|
125
|
+
```bash
|
|
126
|
+
permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --undername staging
|
|
99
127
|
```
|
|
100
128
|
|
|
101
129
|
Deploy with a custom TTL:
|
|
102
130
|
|
|
103
|
-
```
|
|
104
|
-
|
|
131
|
+
```bash
|
|
132
|
+
permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --ttl-seconds 7200
|
|
105
133
|
```
|
|
106
134
|
|
|
107
|
-
Deploy using
|
|
135
|
+
Deploy using Ethereum wallet (file):
|
|
108
136
|
|
|
109
|
-
```
|
|
110
|
-
|
|
137
|
+
```bash
|
|
138
|
+
permaweb-deploy deploy --arns-name my-app --sig-type ethereum --wallet ./private-key.txt
|
|
111
139
|
```
|
|
112
140
|
|
|
113
|
-
|
|
141
|
+
Deploy using Ethereum wallet (direct key):
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
permaweb-deploy deploy --arns-name my-app --sig-type ethereum --private-key "0x1234..."
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### On-Demand Payment
|
|
148
|
+
|
|
149
|
+
Use on-demand payment to automatically fund uploads with ARIO or Base-ETH tokens when your Turbo balance is insufficient:
|
|
150
|
+
|
|
151
|
+
Deploy with ARIO on-demand payment:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --on-demand ario --max-token-amount 1.5
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Deploy with Base-ETH on-demand payment (using Ethereum signer):
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
permaweb-deploy deploy --arns-name my-app --sig-type ethereum --private-key "0x..." --on-demand base-eth --max-token-amount 0.1
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**On-Demand Payment Options:**
|
|
164
|
+
|
|
165
|
+
- `--on-demand`: Token to use for on-demand payment (`ario` or `base-eth`)
|
|
166
|
+
- `--max-token-amount`: Maximum token amount to spend (in native token units, e.g., `1.5` for 1.5 ARIO or `0.1` for 0.1 ETH)
|
|
167
|
+
|
|
168
|
+
**How it works:**
|
|
169
|
+
|
|
170
|
+
1. Checks your Turbo balance before upload
|
|
171
|
+
2. If balance is insufficient, converts tokens to Turbo credits on-demand
|
|
172
|
+
3. Automatically adds a 10% buffer (`topUpBufferMultiplier: 1.1`) for reliability
|
|
173
|
+
4. Proceeds with upload once funded
|
|
174
|
+
|
|
175
|
+
**Token compatibility:**
|
|
176
|
+
|
|
177
|
+
- **ARIO**: Works with Arweave signer
|
|
178
|
+
- **Base-ETH**: Works with Ethereum signer (Base Network)
|
|
179
|
+
|
|
180
|
+
### Command Options
|
|
181
|
+
|
|
182
|
+
- `--arns-name, -n` (required): The ArNS name to update
|
|
183
|
+
- `--ario-process, -p`: ARIO process to use (`mainnet`, `testnet`, or a custom process ID). Default: `mainnet`
|
|
184
|
+
- `--deploy-folder, -d`: Folder to deploy. Default: `./dist`
|
|
185
|
+
- `--deploy-file, -f`: Deploy a single file instead of a folder
|
|
186
|
+
- `--undername, -u`: ANT undername to update. Default: `@`
|
|
187
|
+
- `--ttl-seconds, -t`: TTL in seconds for the ANT record (60-86400). Default: `60`
|
|
188
|
+
- `--sig-type, -s`: Signer type for deployment. Choices: `arweave`, `ethereum`, `polygon`, `kyve`. Default: `arweave`
|
|
189
|
+
- `--wallet, -w`: Path to wallet file (JWK for Arweave, private key for Ethereum/Polygon/KYVE)
|
|
190
|
+
- `--private-key, -k`: Private key or JWK JSON string (alternative to `--wallet`)
|
|
191
|
+
- `--on-demand`: Enable on-demand payment with specified token. Choices: `ario`, `base-eth`
|
|
192
|
+
- `--max-token-amount`: Maximum token amount for on-demand payment (used with `--on-demand`)
|
|
193
|
+
|
|
194
|
+
### Package.json Scripts
|
|
195
|
+
|
|
196
|
+
Add deployment scripts to your `package.json`:
|
|
114
197
|
|
|
115
198
|
```json
|
|
116
|
-
|
|
199
|
+
{
|
|
200
|
+
"scripts": {
|
|
117
201
|
"build": "vite build",
|
|
118
|
-
"deploy": "
|
|
202
|
+
"deploy": "pnpm build && permaweb-deploy deploy --arns-name <ARNS_NAME>",
|
|
203
|
+
"deploy:staging": "pnpm build && permaweb-deploy deploy --arns-name <ARNS_NAME> --undername staging",
|
|
204
|
+
"deploy:testnet": "pnpm build && permaweb-deploy deploy --arns-name <ARNS_NAME> --ario-process testnet",
|
|
205
|
+
"deploy:on-demand": "pnpm build && permaweb-deploy deploy --arns-name <ARNS_NAME> --on-demand ario --max-token-amount 1.5"
|
|
206
|
+
}
|
|
119
207
|
}
|
|
120
208
|
```
|
|
121
209
|
|
|
122
|
-
|
|
210
|
+
Then deploy with:
|
|
123
211
|
|
|
124
|
-
|
|
212
|
+
```bash
|
|
213
|
+
DEPLOY_KEY=$(base64 -i wallet.json) pnpm deploy
|
|
214
|
+
```
|
|
125
215
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
216
|
+
Or with on-demand payment:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
DEPLOY_KEY=$(base64 -i wallet.json) pnpm deploy:on-demand
|
|
130
220
|
```
|
|
131
221
|
|
|
132
|
-
|
|
222
|
+
## GitHub Action
|
|
133
223
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
224
|
+
The easiest way to integrate permaweb-deploy into your CI/CD pipeline is using our official GitHub Action.
|
|
225
|
+
|
|
226
|
+
### Basic Usage
|
|
227
|
+
|
|
228
|
+
```yaml
|
|
229
|
+
- uses: permaweb/permaweb-deploy@v1
|
|
230
|
+
with:
|
|
231
|
+
deploy-key: ${{ secrets.DEPLOY_KEY }}
|
|
232
|
+
arns-name: myapp
|
|
233
|
+
deploy-folder: ./dist
|
|
138
234
|
```
|
|
139
235
|
|
|
140
|
-
|
|
236
|
+
### PR Preview Deployments
|
|
141
237
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
238
|
+
Automatically deploy preview builds for each pull request. The `preview` mode auto-generates an undername from the PR number and posts a comment with the preview URL:
|
|
239
|
+
|
|
240
|
+
```yaml
|
|
241
|
+
name: Deploy PR Preview
|
|
242
|
+
|
|
243
|
+
on:
|
|
244
|
+
pull_request:
|
|
245
|
+
types: [opened, synchronize]
|
|
246
|
+
|
|
247
|
+
jobs:
|
|
248
|
+
deploy-preview:
|
|
249
|
+
runs-on: ubuntu-latest
|
|
250
|
+
steps:
|
|
251
|
+
- uses: actions/checkout@v4
|
|
252
|
+
|
|
253
|
+
- name: Setup Node.js
|
|
254
|
+
uses: actions/setup-node@v4
|
|
255
|
+
with:
|
|
256
|
+
node-version: '20'
|
|
257
|
+
|
|
258
|
+
- name: Install dependencies
|
|
259
|
+
run: npm ci
|
|
260
|
+
|
|
261
|
+
- name: Build
|
|
262
|
+
run: npm run build
|
|
263
|
+
|
|
264
|
+
- name: Deploy Preview
|
|
265
|
+
uses: permaweb/permaweb-deploy@v1
|
|
266
|
+
with:
|
|
267
|
+
deploy-key: ${{ secrets.DEPLOY_KEY }}
|
|
268
|
+
arns-name: myapp
|
|
269
|
+
preview: 'true'
|
|
270
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
271
|
+
deploy-folder: ./dist
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
When `preview` is enabled, the action will:
|
|
275
|
+
|
|
276
|
+
- Auto-generate an undername like `pr-123` from the PR number
|
|
277
|
+
- Post a comment on the PR with the preview URL
|
|
278
|
+
- Update the comment on subsequent pushes instead of creating new ones
|
|
279
|
+
|
|
280
|
+
### Production Deployment
|
|
281
|
+
|
|
282
|
+
Deploy to your base ArNS name when pushing to main:
|
|
283
|
+
|
|
284
|
+
```yaml
|
|
285
|
+
name: Deploy to Production
|
|
286
|
+
|
|
287
|
+
on:
|
|
288
|
+
push:
|
|
289
|
+
branches: [main]
|
|
290
|
+
|
|
291
|
+
jobs:
|
|
292
|
+
deploy:
|
|
293
|
+
runs-on: ubuntu-latest
|
|
294
|
+
steps:
|
|
295
|
+
- uses: actions/checkout@v4
|
|
296
|
+
|
|
297
|
+
- name: Setup Node.js
|
|
298
|
+
uses: actions/setup-node@v4
|
|
299
|
+
with:
|
|
300
|
+
node-version: '20'
|
|
301
|
+
|
|
302
|
+
- name: Install dependencies
|
|
303
|
+
run: npm ci
|
|
304
|
+
|
|
305
|
+
- name: Build
|
|
306
|
+
run: npm run build
|
|
307
|
+
|
|
308
|
+
- name: Deploy to Permaweb
|
|
309
|
+
uses: permaweb/permaweb-deploy@v1
|
|
310
|
+
with:
|
|
311
|
+
deploy-key: ${{ secrets.DEPLOY_KEY }}
|
|
312
|
+
arns-name: myapp
|
|
313
|
+
deploy-folder: ./dist
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### With On-Demand Payment
|
|
317
|
+
|
|
318
|
+
```yaml
|
|
319
|
+
- name: Deploy with ARIO on-demand
|
|
320
|
+
uses: permaweb/permaweb-deploy@v1
|
|
321
|
+
with:
|
|
322
|
+
deploy-key: ${{ secrets.DEPLOY_KEY }}
|
|
323
|
+
arns-name: myapp
|
|
324
|
+
deploy-folder: ./dist
|
|
325
|
+
on-demand: ario
|
|
326
|
+
max-token-amount: '2.0'
|
|
146
327
|
```
|
|
147
328
|
|
|
148
|
-
|
|
329
|
+
---
|
|
149
330
|
|
|
150
|
-
|
|
331
|
+
## CLI in GitHub Actions
|
|
332
|
+
|
|
333
|
+
You can also use the CLI directly in your workflows:
|
|
334
|
+
|
|
335
|
+
**Basic Workflow:**
|
|
151
336
|
|
|
152
337
|
```yaml
|
|
153
338
|
name: Deploy to Permaweb
|
|
339
|
+
|
|
340
|
+
on:
|
|
341
|
+
push:
|
|
342
|
+
branches:
|
|
343
|
+
- main
|
|
344
|
+
|
|
345
|
+
jobs:
|
|
346
|
+
publish:
|
|
347
|
+
runs-on: ubuntu-latest
|
|
348
|
+
steps:
|
|
349
|
+
- uses: actions/checkout@v4
|
|
350
|
+
|
|
351
|
+
- uses: pnpm/action-setup@v3
|
|
352
|
+
with:
|
|
353
|
+
version: 9
|
|
354
|
+
|
|
355
|
+
- uses: actions/setup-node@v4
|
|
356
|
+
with:
|
|
357
|
+
node-version: 20
|
|
358
|
+
cache: 'pnpm'
|
|
359
|
+
|
|
360
|
+
- run: pnpm install
|
|
361
|
+
|
|
362
|
+
- run: pnpm deploy
|
|
363
|
+
env:
|
|
364
|
+
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**With On-Demand Payment:**
|
|
368
|
+
|
|
369
|
+
```yaml
|
|
370
|
+
name: Deploy to Permaweb with On-Demand Payment
|
|
371
|
+
|
|
154
372
|
on:
|
|
155
373
|
push:
|
|
156
374
|
branches:
|
|
157
375
|
- main
|
|
376
|
+
|
|
158
377
|
jobs:
|
|
159
378
|
publish:
|
|
160
379
|
runs-on: ubuntu-latest
|
|
161
380
|
steps:
|
|
162
381
|
- uses: actions/checkout@v4
|
|
382
|
+
|
|
383
|
+
- uses: pnpm/action-setup@v3
|
|
384
|
+
with:
|
|
385
|
+
version: 9
|
|
386
|
+
|
|
163
387
|
- uses: actions/setup-node@v4
|
|
164
388
|
with:
|
|
165
|
-
node-version: 20
|
|
166
|
-
|
|
167
|
-
|
|
389
|
+
node-version: 20
|
|
390
|
+
cache: 'pnpm'
|
|
391
|
+
|
|
392
|
+
- run: pnpm install
|
|
393
|
+
- run: pnpm build
|
|
394
|
+
|
|
395
|
+
- name: Deploy with ARIO on-demand
|
|
396
|
+
run: permaweb-deploy deploy --arns-name my-app --on-demand ario --max-token-amount 2.0
|
|
168
397
|
env:
|
|
169
398
|
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
|
399
|
+
|
|
400
|
+
# Or deploy with Ethereum and Base-ETH:
|
|
401
|
+
# - name: Deploy with Base-ETH on-demand
|
|
402
|
+
# run: |
|
|
403
|
+
# permaweb-deploy deploy \
|
|
404
|
+
# --arns-name my-app \
|
|
405
|
+
# --sig-type ethereum \
|
|
406
|
+
# --on-demand base-eth \
|
|
407
|
+
# --max-token-amount 0.2
|
|
408
|
+
# env:
|
|
409
|
+
# DEPLOY_KEY: ${{ secrets.ETH_PRIVATE_KEY }}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
## Development
|
|
413
|
+
|
|
414
|
+
### Setup
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
# Install dependencies
|
|
418
|
+
pnpm install
|
|
419
|
+
|
|
420
|
+
# Build the project
|
|
421
|
+
pnpm build
|
|
422
|
+
|
|
423
|
+
# Run in development mode
|
|
424
|
+
pnpm dev
|
|
425
|
+
|
|
426
|
+
# Run tests
|
|
427
|
+
pnpm test
|
|
428
|
+
|
|
429
|
+
# Run linter
|
|
430
|
+
pnpm lint
|
|
431
|
+
|
|
432
|
+
# Format code
|
|
433
|
+
pnpm format
|
|
170
434
|
```
|
|
171
435
|
|
|
436
|
+
### Project Structure
|
|
172
437
|
|
|
173
|
-
|
|
438
|
+
```
|
|
439
|
+
permaweb-deploy/
|
|
440
|
+
├── src/
|
|
441
|
+
│ ├── commands/ # oclif commands
|
|
442
|
+
│ │ └── deploy.ts
|
|
443
|
+
│ ├── types/ # TypeScript type definitions
|
|
444
|
+
│ │ └── index.ts
|
|
445
|
+
│ ├── utils/ # Utility functions
|
|
446
|
+
│ │ ├── constants.ts
|
|
447
|
+
│ │ ├── signer.ts
|
|
448
|
+
│ │ ├── uploader.ts
|
|
449
|
+
│ │ └── __tests__/ # Unit tests
|
|
450
|
+
│ └── index.ts # Main entry point
|
|
451
|
+
├── bin/ # Executable scripts
|
|
452
|
+
│ ├── run.js
|
|
453
|
+
│ └── dev.js
|
|
454
|
+
├── .changeset/ # Changesets configuration
|
|
455
|
+
├── .husky/ # Git hooks
|
|
456
|
+
└── dist/ # Build output
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
## Security & Best Practices
|
|
174
460
|
|
|
175
461
|
- **Dedicated Wallet:** Always use a dedicated wallet for deployments to minimize security risks
|
|
176
462
|
- **Wallet Encoding:** Arweave wallets must be base64 encoded to be used in the deployment script
|
|
177
463
|
- **ArNS Name:** The ArNS Name must be passed so that the ANT Process can be resolved to update the target undername or root record
|
|
178
|
-
- **Turbo Credits:** Ensure your wallet has sufficient Turbo Credits
|
|
464
|
+
- **Turbo Credits:** Ensure your wallet has sufficient Turbo Credits, or use on-demand payment for automatic funding
|
|
465
|
+
- **On-Demand Limits:** Set reasonable `--max-token-amount` limits to prevent unexpected costs
|
|
179
466
|
- **Secret Management:** Keep your `DEPLOY_KEY` secret secure and never commit it to your repository
|
|
180
467
|
- **Build Security:** Always check your build for exposed environmental secrets before deployment, as data on Arweave is permanent
|
|
181
468
|
|
|
182
|
-
|
|
469
|
+
## Troubleshooting
|
|
183
470
|
|
|
184
|
-
- **Error: "
|
|
185
|
-
- **Error: "DEPLOY_KEY not configured":** Verify your base64 encoded wallet is set as the `DEPLOY_KEY` environment variable
|
|
471
|
+
- **Error: "DEPLOY_KEY environment variable not set":** Verify your base64 encoded wallet is set as the `DEPLOY_KEY` environment variable
|
|
186
472
|
- **Error: "deploy-folder does not exist":** Check that your build folder exists and the path is correct
|
|
187
473
|
- **Error: "deploy-file does not exist":** Check that your build file exists and the path is correct
|
|
188
|
-
- **Error: "
|
|
189
|
-
- **Upload timeouts:** Files have a
|
|
190
|
-
- **Insufficient Turbo Credits:**
|
|
474
|
+
- **Error: "ArNS name does not exist":** Verify the ArNS name is correct and exists in the specified network
|
|
475
|
+
- **Upload timeouts:** Files have a timeout for upload. Large files may fail and require optimization
|
|
476
|
+
- **Insufficient Turbo Credits:** Use `--on-demand` with `--max-token-amount` to automatically fund uploads when balance is low
|
|
477
|
+
- **On-demand payment fails:** Ensure your wallet has sufficient tokens (ARIO or Base-ETH) and the token type matches your signer (`ario` with Arweave, `base-eth` with Ethereum)
|
|
478
|
+
|
|
479
|
+
## Contributing
|
|
480
|
+
|
|
481
|
+
Contributions are welcome! Please follow these guidelines:
|
|
482
|
+
|
|
483
|
+
1. Fork the repository
|
|
484
|
+
2. Create a feature branch
|
|
485
|
+
3. Make your changes
|
|
486
|
+
4. Run tests and linter: `pnpm test && pnpm lint`
|
|
487
|
+
5. Create a changeset: `pnpm changeset`
|
|
488
|
+
6. Commit your changes using conventional commits
|
|
489
|
+
7. Push and create a pull request
|
|
490
|
+
|
|
491
|
+
### Conventional Commits
|
|
492
|
+
|
|
493
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/). Commit messages should follow this format:
|
|
494
|
+
|
|
495
|
+
```
|
|
496
|
+
type(scope): subject
|
|
497
|
+
|
|
498
|
+
body (optional)
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
|
|
502
|
+
|
|
503
|
+
### Changesets
|
|
504
|
+
|
|
505
|
+
We use [changesets](https://github.com/changesets/changesets) for version management. When making changes:
|
|
506
|
+
|
|
507
|
+
```bash
|
|
508
|
+
pnpm changeset
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
Follow the prompts to describe your changes.
|
|
512
|
+
|
|
513
|
+
## Dependencies
|
|
514
|
+
|
|
515
|
+
- **@ar.io/sdk** - For ANT operations and ArNS management
|
|
516
|
+
- **@ardrive/turbo-sdk** - For fast file uploads to Arweave
|
|
517
|
+
- **@permaweb/aoconnect** - For AO network connectivity
|
|
518
|
+
- **@oclif/core** - CLI framework
|
|
519
|
+
- **mime-types** - MIME type detection
|
|
520
|
+
|
|
521
|
+
## License
|
|
522
|
+
|
|
523
|
+
ISC
|
|
524
|
+
|
|
525
|
+
## Author
|
|
526
|
+
|
|
527
|
+
NickJ202
|
|
191
528
|
|
|
192
|
-
|
|
529
|
+
## Links
|
|
193
530
|
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
197
|
-
-
|
|
531
|
+
- [GitHub Repository](https://github.com/permaweb/permaweb-deploy)
|
|
532
|
+
- [Issues](https://github.com/permaweb/permaweb-deploy/issues)
|
|
533
|
+
- [Arweave Documentation](https://docs.arweave.org/)
|
|
534
|
+
- [AR.IO Documentation](https://docs.ar.io/)
|
package/bin/dev.js
ADDED