Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ci for generating + publishing schema.json #23

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/generate-schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Generate Schema"

on:
pull_request:

permissions:
contents: write
pull-requests: write

env:
DENO_DIR: ~/.deno-cache

jobs:
release:
runs-on: ubuntu-latest

strategy:
matrix:
deno-version: [1.41.3]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Setup Deno ${{ matrix.deno-version }}
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}
- name: Run generate-schema
run: deno task generate-schema
- name: Commit and push to pr
run: |
diff=$(git diff schema.json)
if [[ "${diff}" ]]; then
git config user.name github-actions
git config user.email [email protected]
git add schema.json
git commit -m 'chore(schema): generate'
git push
exit 0
fi
echo "skipping"
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ steps.release.outputs.tag_name }} ./build/runreal-win-x64.exe ./build/runreal-macos-arm ./build/runreal-linux-x64
run: gh release upload ${{ steps.release.outputs.tag_name }} ./build/runreal-win-x64.exe ./build/runreal-macos-arm ./build/runreal-linux-x64 schema.json

- name: Cache Deno dependencies
if: ${{ steps.release.outputs.release_created }}
Expand Down
100 changes: 37 additions & 63 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,48 +42,30 @@
"type": "string",
"description": "Path to the project folder <RUNREAL_PROJECT_PATH>"
},
"buildPath": {
"type": "string",
"description": "Path to the build folder <RUNREAL_BUILD_PATH>"
},
"repoType": {
"type": "string",
"description": "git or perforce"
}
},
"required": [
"path",
"buildPath",
"repoType"
],
"additionalProperties": false
},
"build": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "Path to the build folder <RUNREAL_BUILD_PATH>"
},
"id": {
"type": "string",
"description": "Build id <RUNREAL_BUILD_ID>"
},
"branch": {
"type": "string",
"description": "Branch name"
},
"branchSafe": {
"type": "string",
"description": "Branch name safe for filenames"
},
"commit": {
"type": "string",
"description": "Commit hash"
},
"commitShort": {
"type": "string",
"description": "Short commit hash"
}
},
"required": [
"path"
],
"additionalProperties": false
},
"git": {
Expand All @@ -107,56 +89,48 @@
"workflows": {
"type": "array",
"items": {
"anyOf": [
{
"not": {}
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Workflow name"
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Workflow name"
},
"steps": {
"type": "array",
"items": {
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "Command to execute"
},
"args": {
"type": "array",
"items": {
"type": "string"
},
"description": "Command arguments"
}
"steps": {
"type": "array",
"items": {
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "Command to execute"
},
"args": {
"type": "array",
"items": {
"type": "string"
},
"required": [
"command"
],
"additionalProperties": false
"description": "Command arguments"
}
}
},
"required": [
"name",
"steps"
],
"additionalProperties": false
},
"required": [
"command"
],
"additionalProperties": false
}
}
]
},
"required": [
"name",
"steps"
],
"additionalProperties": false
}
}
},
"required": [
"engine",
"project",
"build",
"workflows"
"build"
],
"additionalProperties": false,
"$schema": "https://json-schema.org/draft/2019-09/schema#"
Expand Down