Skip to content

Commit

Permalink
fix: Publish generator (#29)
Browse files Browse the repository at this point in the history
* docs: Added Bonob cool project
* docs: Updated music service
* ci: Releasing the generator as npm package (hopefully)
  • Loading branch information
svrooij committed Sep 22, 2021
1 parent 4f2a2d3 commit 3b5e3d7
Show file tree
Hide file tree
Showing 12 changed files with 4,488 additions and 161 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
on:
workflow_dispatch:
push:
branches:
- main
- ci-build
paths:
- '.github/workflows/generator.yml'
- 'generator/sonos-docs/src/**/*.ts'

pull_request:
branches:
- main
paths:
- '.github/workflows/generator.yml'
- 'generator/sonos-docs/src/**/*.ts'

jobs:
test:
name: 'Build and test on Node v${{ matrix.node }}'
runs-on: ubuntu-latest
strategy:
matrix:
node: [14, 16]
defaults:
run:
working-directory: generator/sonos-docs
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install depencencies
run: npm ci
- name: Build library
run: npm run prepack

release:
name: 'Release generator'
needs: [test]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
defaults:
run:
working-directory: generator/sonos-docs
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: Install depencencies
run: npm ci
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup node for Github Registry
if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/setup-node@v2
with:
node-version: 16
registry-url: 'https://npm.pkg.github.com'
scope: 'svrooij'
- name: Publish To GitHub Package Registry
if: steps.semantic.outputs.new_release_published == 'true'
run: |
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
33 changes: 10 additions & 23 deletions .github/workflows/json-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,20 @@ on:

jobs:
validate-docs:
name: Validate main JSON files
name: Validate JSON files
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Use node 12
uses: actions/setup-node@v1
- name: Use node 16
uses: actions/setup-node@v2
with:
node-version: 12
node-version: 16
- name: Install ajv-cli
run: npm i -g ajv-cli
- name: Validate docs/_data/projects.json
run: npx ajv-cli validate -d ./docs/_data/projects.json -s ./docs/schema/projects.json -r ./docs/schema/author.json
run: ajv validate -d ./docs/_data/projects.json -s ./docs/schema/projects.json -r ./docs/schema/author.json
- name: Validate docs/documentation.json
run: npx ajv-cli -s ./docs/schema/documentation.json -d ./docs/documentation.json

validate-templates:
name: Validate template JSON files
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Use node 12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Validate docs template.json
run: npx ajv-cli -s ./docs/schema/template.json -r ./docs/schema/author.json -d ./generator/sonos-docs/templates/docs/template.json
- name: Validate ts template.json
run: npx ajv-cli -s ./docs/schema/template.json -r ./docs/schema/author.json -d ./generator/sonos-docs/templates/ts/template.json
- name: Validate node template.json
run: npx ajv-cli -s ./docs/schema/template.json -r ./docs/schema/author.json -d ./generator/sonos-docs/templates/node/template.json
run: ajv validate -s ./docs/schema/documentation.json -d ./docs/documentation.json
- name: Validate template json files
run: ajv validate -s ./docs/schema/template.json -d "./generator/sonos-docs/templates/**/template.json" -r ./docs/schema/author.json
4 changes: 3 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ jobs:
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter@v3
uses: github/super-linter/slim@v4
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_JAVASCRIPT_STANDARD: false
VALIDATE_TYPESCRIPT_STANDARD: false
VALIDATE_JSCPD: false
VALIDATE_HTML: false
FILTER_REGEX_EXCLUDE: .*docs/services/*.md
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Check-out the (generated) documentation about all the SONOS UPNP services [svroo

### Manually documented

The [sonos services](https://svrooij.io/sonos-api-docs/services/) have no documentation, that is way we manually created a [documentation.json](http://svrooij.io/sonos-api-docs/documentation.json) file. To easily add documentation to all services (that are generated with the generator). And it's json so you can easily use it yourself.
The [sonos services](https://svrooij.io/sonos-api-docs/services/) have no documentation, that is why we manually created a [documentation.json](http://svrooij.io/sonos-api-docs/documentation.json) file. To easily add documentation to all services (that are generated with the generator). And it's json so you can easily use it yourself.

### Device discovery files

Expand All @@ -39,7 +39,7 @@ You can use the generator to generate your own discovery files, but we also have
| Sonos Roam | [S2](https://github.com/svrooij/sonos-api-docs/raw/main/generator/sonos-docs/data/sonos-S27-2.json) |
| Sonos Sub | [S2](https://github.com/svrooij/sonos-api-docs/raw/main/generator/sonos-docs/data/sonos-Sub-2.json) |

These files toghether with the documentation file, are combined to a extensive JSON file, that is used as an input for the generator.
These files together with the documentation file, are combined to a extensive JSON file, that is used as an input for the generator.

## Community

Expand Down
10 changes: 10 additions & 0 deletions docs/_data/projects.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@
"link": "https://github.com/ioBroker/ioBroker.sonos",
"repository": "https://github.com/ioBroker/ioBroker.sonos",
"tags": ["ioBroker"]
},
{
"name": "Bonob",
"description": "Custom sonos music service for self-hosted Navidrome",
"link": "https://github.com/simojenki/bonob",
"repository": "https://github.com/simojenki/bonob",
"author": {
"name": "Simon J",
"link": "https://github.com/simojenki"
}
}
],
"libraries": [
Expand Down
Loading

0 comments on commit 3b5e3d7

Please sign in to comment.