Skip to content

Commit ec2e9a4

Browse files
committed
chore: add examples and warnings for build_path and working_path, in the documentation
1 parent 72f5b54 commit ec2e9a4

File tree

1 file changed

+161
-6
lines changed

1 file changed

+161
-6
lines changed

README.md

Lines changed: 161 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,163 @@ Grateful to the [Greg Sadetsky](https://github.com/gregsadetsky) for his proposi
150150
<br>
151151

152152

153+
<a name="build_path"></a>
153154
### `build_path`(optional)
154-
| Type | Default | Example Values |
155-
|----------|----------|--------------------------------------|
156-
| `string` | `./dist` | - `./deploy`<br/> - `./dist/browser` |
155+
| Type | Default | Example Values |
156+
|----------|----------|--------------------------------------------------------|
157+
| `string` | `./dist` | - `./deploy`<br/> - `./dist/browser` <br/> - `../dist` |
158+
159+
Which folder do you want your GitHub Page to use as root directory of deployment, after the build process. Simply it is your build output directory such as `./dist`. If your `vite` config exports to a folder other than `./dist`, then you should pass it as parameter.
160+
161+
#### :warning: `build_path` works along with `working_path` [see section](#working_path)
162+
163+
Here's how `build_path` is resolved and utilized while working along `working_path` parameter.
164+
165+
- If `build_path` is an absolute path (e.g: `build_path: /some-folder/sub-folder`, then it is used as is
166+
- Keep in mind this absolute path is really absolute, `/` doesn't point to repository root, it points to
167+
- If `build_path` is NOT an absolute path
168+
- If `working_path: ./` (default value) then use `build_path` as is
169+
- If `working_path` is NOT the default value (repository root), then combine `working_path` and `build_path` and use it as build directory.
170+
171+
See the examples below to understand how it is resolved.
172+
173+
<details>
174+
175+
<summary><b>Example-1: Standard repository</b></summary>
176+
177+
178+
#### Example-1: Standard repository
179+
180+
---
181+
182+
```
183+
.
184+
├── src/
185+
├── dist/ (doesn't exist in repository, created during build)
186+
├── package.json
187+
├── package-lock.json
188+
├── docs/
189+
└── README.md
190+
```
191+
192+
Then you don't have to configure any parameters for the action. This is the default setup with the following default parameter values:
193+
- `build_path: ./dist`
194+
- `working_path: ./`
195+
- Resolved build output folder: `./dist`
196+
197+
---
198+
199+
200+
</details>
201+
202+
203+
<details>
204+
205+
<summary><b>Example-2: All code related files reside under a folder</b></summary>
206+
207+
---
208+
209+
#### Example-2: All code related files reside under a folder
210+
211+
```
212+
.
213+
├── app/
214+
│ └── src/
215+
│ └── dist/ (doesn't exist in repository, created during build)
216+
│ └── package.json
217+
│ └── package-lock.json
218+
└── docs/
219+
└── README.md
220+
```
221+
222+
Pass the following parameters:
223+
```yml
224+
- name: Deploy to Github Pages
225+
uses: skywarth/vite-github-pages-deployer@master
226+
id: deploy_to_pages
227+
with:
228+
working_path: ./app
229+
```
230+
- With this setup, the resolved build output folder is: `./app/dist`
231+
232+
---
233+
234+
</details>
235+
236+
237+
<details>
238+
239+
<summary><b> Example-3: All code related files reside under a folder, with a custom build folder name</b></summary>
240+
241+
#### Example-3: All code related files reside under a folder, with a custom build folder name
242+
243+
---
244+
245+
```
246+
.
247+
├── app/
248+
│ └── src/
249+
│ └── my_custom_build_folder/ (doesn't exist in repository, created during build)
250+
│ └── package.json
251+
│ └── package-lock.json
252+
└── docs/
253+
└── README.md
254+
```
255+
256+
Pass the following parameters:
257+
```yml
258+
- name: Deploy to Github Pages
259+
uses: skywarth/vite-github-pages-deployer@master
260+
id: deploy_to_pages
261+
with:
262+
working_path: ./app
263+
build_path: my_custom_build_folder
264+
```
265+
- With this setup, the resolved build output folder is: `./app/my_custom_build_folder`
266+
267+
---
268+
269+
</details>
270+
271+
272+
<details>
273+
274+
<summary><b> Example-4: All code related files reside under a folder, except the build folder, with a custom build folder name</b></summary>
275+
276+
#### Example-4: All code related files reside under a folder, except the build folder, with a custom build folder name
277+
278+
---
279+
280+
```
281+
.
282+
├── app/
283+
│ └── src/
284+
│ └── package.json
285+
│ └── package-lock.json
286+
└── deploy/
287+
└── docs/
288+
└── README.md
289+
```
290+
291+
Pass the following parameters:
292+
```yml
293+
- name: Deploy to Github Pages
294+
uses: skywarth/vite-github-pages-deployer@master
295+
id: deploy_to_pages
296+
with:
297+
working_path: ./app
298+
build_path: ../deploy
299+
```
300+
- With this setup, the resolved build output folder is: `./deploy`, because `./app/../deploy`
301+
302+
---
303+
304+
</details>
305+
306+
307+
308+
157309

158-
Which folder do you want your GitHub Page to use as root directory, after the build process. Simply it is your build output directory such as `./dist`. If your `vite` config exports to a folder other than `./dist`, then you should pass it as parameter.
159310

160311

161312
### `install_phase_node_env`(optional)
@@ -194,14 +345,16 @@ Desired name for the exposed artifact. This name is visible in job and used as t
194345

195346
Indicate the package manager of preferrence. It'll be used for installing dependencies and building the `dist`. For example if you prefer/use `yarn` as your package manager for the project, then you may pass `package_manager: 'yarn'` as input which then will be used as `yarn install` and `yarn build`.
196347

197-
348+
<a name="working_path"></a>
198349
### `working_path` (optional)
199350
| Type | Default | Example Values |
200351
|----------|-----------|------------------------------|
201352
| `string` | `./` | - './app' <br/> `./example` |
202353

354+
- :warning: **Make sure `working_path` points to where your `package.json` is!**
355+
- `working_path` affects `build_path` resolution, [see section](#build_path)
203356

204-
Specifies the directory where the install, build, and deploy commands should be executed.
357+
Specifies the directory where the `install`, `build`, and deploy commands should be executed.
205358

206359
**Example:**
207360

@@ -326,6 +479,8 @@ See the [example workflow](#example-workflow) if you're not sure where to place
326479
- [X] Table of Content
327480
- [ ] ~~Move bash scripts to a separate file for each section: build.sh, install.sh etc...~~ (not feasible, see the branch `bash-files`)
328481
- [ ] ~~Passing some parameters to it perhaps~~ (not feasible, see the branch `bash-files`)
482+
- [ ] Public docs deployment, `README` is becoming rather *rudimentary*
483+
- [ ] Update ToC to include each input parameter
329484
330485
### Something is lacking ?
331486

0 commit comments

Comments
 (0)