Skip to content

Commit 39b4729

Browse files
committed
Added auto gen docs and github action
1 parent f314322 commit 39b4729

File tree

9 files changed

+405
-4
lines changed

9 files changed

+405
-4
lines changed

.github/workflows/build.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build and Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build-and-release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 18
19+
20+
- name: Install dependencies and build
21+
run: |
22+
npm ci
23+
npm run build
24+
25+
- name: Get last modified file
26+
id: getfile
27+
run: |
28+
last_modified_file=$(ls -Art dist | tail -n 1)
29+
echo "Last modified file: $last_modified_file"
30+
echo "filename=$last_modified_file" >> $GITHUB_OUTPUT
31+
version=$(echo $last_modified_file | sed -n 's/.*-\([0-9.]*\).c3addon/\1/p')
32+
echo "Last modified file version: $version"
33+
echo "version=$version" >> $GITHUB_OUTPUT
34+
35+
- name: Create Release
36+
id: create_release
37+
uses: ncipollo/release-action@v1
38+
with:
39+
artifacts: "dist/${{ steps.getfile.outputs.filename }}"
40+
omitBody: true
41+
tag: ${{ steps.getfile.outputs.filename }}
42+
name: v${{ steps.getfile.outputs.version }}
43+
allowUpdates: true
44+
makeLatest: true
45+
46+
- name: Check if variables are set
47+
id: check
48+
run: |
49+
publish=true
50+
if [[ -z "${{ secrets.C3_AUTH_USER }}" ]]; then
51+
echo "C3 AUTH_USER is not set. skip publishing."
52+
publish=false
53+
fi
54+
if [[ -z "${{ secrets.C3_AUTH_PASSWORD }}" ]]; then
55+
echo "C3 AUTH_PASSWORD is not set. skip publishing."
56+
publish=false
57+
fi
58+
echo "publish=$publish" >> $GITHUB_OUTPUT
59+
60+
- name: Install publish dependencies
61+
if: steps.check.outputs.publish == 'true'
62+
run: |
63+
npm install -g c3addon
64+
65+
- name: Get Addon Url
66+
if: steps.check.outputs.publish == 'true'
67+
id: url
68+
run: |
69+
url=$(grep -oP 'addonUrl:\s?"\K[^"]*' config.caw.js | cut -d '"' -f 1)
70+
echo "Addon Url: $url"
71+
if [[ -z "$url" ]]; then
72+
echo "Addon Url is not set. skip publishing."
73+
exit 1
74+
fi
75+
echo "url=$url" >> $GITHUB_OUTPUT
76+
77+
- name: Publish to Construct 3
78+
if: steps.check.outputs.publish == 'true'
79+
run: |
80+
c3addon publish \
81+
--addonUrl '${{steps.url.outputs.url}}' \
82+
--authUser ${{ secrets.C3_AUTH_USER }} \
83+
--authPassword ${{ secrets.C3_AUTH_PASSWORD }} \
84+
--uploadFile dist/${{ steps.getfile.outputs.filename }} \
85+
--version ${{ steps.getfile.outputs.version }} \
86+
--releaseNotes 'Released via GitHub Actions'

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"dist/exportStep": true,
1010
"package-lock.json": true,
1111
"package.json": true,
12-
".vscode": true
12+
".vscode": true,
13+
".github": true
1314
},
1415
"workspaceKeybindings.cawKeybinds.enabled": true
1516
}

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<img src="./src/icon.svg" width="100" /><br>
2+
# Sample Addon <br>
3+
Description <br>
4+
<br>
5+
Author: skymen <br>
6+
Download Latest Version : [Version: 1.0.0.0](https://github.com/ConstructFund/construct-addon-wizard-scaffold/releases/latest) <br>
7+
<sub>Made using [CAW](https://marketplace.visualstudio.com/items?itemName=skymen.caw) </sub><br>
8+
9+
## Table of Contents
10+
- [Usage](#usage)
11+
- [Examples Files](#examples-files)
12+
- [Properties](#properties)
13+
- [Actions](#actions)
14+
- [Conditions](#conditions)
15+
- [Expressions](#expressions)
16+
---
17+
## Usage
18+
To build the addon, run the following commands:
19+
20+
```
21+
npm i
22+
npm run build
23+
```
24+
25+
To run the dev server, run
26+
27+
```
28+
npm i
29+
npm run dev
30+
```
31+
32+
## Examples Files
33+
34+
---
35+
## Properties
36+
| Property Name | Description | Type |
37+
| --- | --- | --- |
38+
39+
40+
---
41+
## Actions
42+
| Action | Description | Params
43+
| --- | --- | --- |
44+
| Sample Action | This is a sample action | Param1 *(string)* <br> |
45+
| Sample Action Async | This is a sample action | |
46+
| Sample Action Combo | This is a sample action | Param1 *(combo)* <br> |
47+
| Sample Action | This is a sample action | Param1 *(string)* <br> |
48+
49+
50+
---
51+
## Conditions
52+
| Condition | Description | Params
53+
| --- | --- | --- |
54+
| Sample Condition | This is a sample condition | Param1 *(string)* <br> |
55+
| Sample Trigger | This is a sample trigger | |
56+
| Sample Condition | This is a sample condition | Param1 *(combo)* <br> |
57+
| Sample Condition | This is a sample condition | |
58+
59+
60+
---
61+
## Expressions
62+
| Expression | Description | Return Type | Params
63+
| --- | --- | --- | --- |
64+
| Expression | Sample Expression | number | |
65+
| Expression2 | Sample Expression | string | |
66+
| SampleExpression | This is a sample expression | string | |

build/build.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const buildSteps = [
2121
"./processDependencies.js",
2222
"./validateIcon.js",
2323
"./packageAddon.js",
24+
"./generateDocumentation.js",
2425
"./cleanup.js",
2526
];
2627

0 commit comments

Comments
 (0)