Skip to content

Commit

Permalink
Added auto gen docs and github action
Browse files Browse the repository at this point in the history
  • Loading branch information
skymen committed Jan 15, 2025
1 parent f314322 commit 39b4729
Show file tree
Hide file tree
Showing 9 changed files with 405 additions and 4 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build and Release
on:
push:
branches:
- main

jobs:
build-and-release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies and build
run: |
npm ci
npm run build
- name: Get last modified file
id: getfile
run: |
last_modified_file=$(ls -Art dist | tail -n 1)
echo "Last modified file: $last_modified_file"
echo "filename=$last_modified_file" >> $GITHUB_OUTPUT
version=$(echo $last_modified_file | sed -n 's/.*-\([0-9.]*\).c3addon/\1/p')
echo "Last modified file version: $version"
echo "version=$version" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/${{ steps.getfile.outputs.filename }}"
omitBody: true
tag: ${{ steps.getfile.outputs.filename }}
name: v${{ steps.getfile.outputs.version }}
allowUpdates: true
makeLatest: true

- name: Check if variables are set
id: check
run: |
publish=true
if [[ -z "${{ secrets.C3_AUTH_USER }}" ]]; then
echo "C3 AUTH_USER is not set. skip publishing."
publish=false
fi
if [[ -z "${{ secrets.C3_AUTH_PASSWORD }}" ]]; then
echo "C3 AUTH_PASSWORD is not set. skip publishing."
publish=false
fi
echo "publish=$publish" >> $GITHUB_OUTPUT
- name: Install publish dependencies
if: steps.check.outputs.publish == 'true'
run: |
npm install -g c3addon
- name: Get Addon Url
if: steps.check.outputs.publish == 'true'
id: url
run: |
url=$(grep -oP 'addonUrl:\s?"\K[^"]*' config.caw.js | cut -d '"' -f 1)
echo "Addon Url: $url"
if [[ -z "$url" ]]; then
echo "Addon Url is not set. skip publishing."
exit 1
fi
echo "url=$url" >> $GITHUB_OUTPUT
- name: Publish to Construct 3
if: steps.check.outputs.publish == 'true'
run: |
c3addon publish \
--addonUrl '${{steps.url.outputs.url}}' \
--authUser ${{ secrets.C3_AUTH_USER }} \
--authPassword ${{ secrets.C3_AUTH_PASSWORD }} \
--uploadFile dist/${{ steps.getfile.outputs.filename }} \
--version ${{ steps.getfile.outputs.version }} \
--releaseNotes 'Released via GitHub Actions'
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"dist/exportStep": true,
"package-lock.json": true,
"package.json": true,
".vscode": true
".vscode": true,
".github": true
},
"workspaceKeybindings.cawKeybinds.enabled": true
}
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<img src="./src/icon.svg" width="100" /><br>
# Sample Addon <br>
Description <br>
<br>
Author: skymen <br>
Download Latest Version : [Version: 1.0.0.0](https://github.com/ConstructFund/construct-addon-wizard-scaffold/releases/latest) <br>
<sub>Made using [CAW](https://marketplace.visualstudio.com/items?itemName=skymen.caw) </sub><br>

## Table of Contents
- [Usage](#usage)
- [Examples Files](#examples-files)
- [Properties](#properties)
- [Actions](#actions)
- [Conditions](#conditions)
- [Expressions](#expressions)
---
## Usage
To build the addon, run the following commands:

```
npm i
npm run build
```

To run the dev server, run

```
npm i
npm run dev
```

## Examples Files

---
## Properties
| Property Name | Description | Type |
| --- | --- | --- |


---
## Actions
| Action | Description | Params
| --- | --- | --- |
| Sample Action | This is a sample action | Param1 *(string)* <br> |
| Sample Action Async | This is a sample action | |
| Sample Action Combo | This is a sample action | Param1 *(combo)* <br> |
| Sample Action | This is a sample action | Param1 *(string)* <br> |


---
## Conditions
| Condition | Description | Params
| --- | --- | --- |
| Sample Condition | This is a sample condition | Param1 *(string)* <br> |
| Sample Trigger | This is a sample trigger | |
| Sample Condition | This is a sample condition | Param1 *(combo)* <br> |
| Sample Condition | This is a sample condition | |


---
## Expressions
| Expression | Description | Return Type | Params
| --- | --- | --- | --- |
| Expression | Sample Expression | number | |
| Expression2 | Sample Expression | string | |
| SampleExpression | This is a sample expression | string | |
1 change: 1 addition & 0 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const buildSteps = [
"./processDependencies.js",
"./validateIcon.js",
"./packageAddon.js",
"./generateDocumentation.js",
"./cleanup.js",
];

Expand Down
Loading

0 comments on commit 39b4729

Please sign in to comment.