Skip to content

Commit

Permalink
feat: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
laduke committed Feb 13, 2024
0 parents commit 9ae6d79
Show file tree
Hide file tree
Showing 12 changed files with 8,041 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-env node */
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
};
54 changes: 54 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
push:
branches: ["main"]

pull_request:

permissions:
contents: read
pages: write
id-token: write

jobs:
build_lint_etc:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install zerotier-one
run: curl -s https://install.zerotier.com/ | sudo bash

- run: npm ci
- run: npm run build

- name: Set authtoken
run: echo "AUTH_TOKEN=$(sudo cat /var/lib/zerotier-one/authtoken.secret)" >> $GITHUB_ENV

- name: Run tests
run: npm test

- name: Archive built docs html
uses: actions/upload-artifact@v4
with:
name: index.html
path: dist/index.html

- name: Archive built openapi spec
uses: actions/upload-artifact@v4
with:
name: openapi.yaml
path: tsp-output/@typespec/openapi3/openapi.yaml

- name: Archive built json schema
uses: actions/upload-artifact@v4
with:
name: json-schema.json
path: tsp-output/@typespec/json-schema/json-schema.json
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: npm version && npm publish

on:
workflow_dispatch:
inputs:
newversion:
description: 'npm version {major,minor,patch}'
required: true
permissions:
contents: write
jobs:
version_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# fetch full history so things like auto-changelog work properly
fetch-depth: 0

- name: Install zerotier-one
run: curl -s https://install.zerotier.com/ | sudo bash

- name: Set auth token
run: echo "AUTH_TOKEN=$(sudo cat /var/lib/zerotier-one/authtoken.secret)" >> $GITHUB_ENV

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'

- run: npm ci
- run: npm run build
- run: npm test
- run: git config --global user.email "travis.laduke@zerotier.com"
- run: git config --global user.name "travis laduke"
- run: npm version ${{ github.event.inputs.newversion }}
- run: npm run release
env:
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/node_modules/
/tsp-output/
/.DS_Store
/dist/
.DS_Store
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [v0.2.0](https://github.com/laduke/curly-octo-guacamole/compare/v0.1.1...v0.2.0)

### Commits

- feat: add to and improve spec and tests [`0733ce4`](https://github.com/laduke/curly-octo-guacamole/commit/0733ce4cb5841681cb8cbc7536eafd70e0195656)
- feat: test some network controller endpoints [`6096483`](https://github.com/laduke/curly-octo-guacamole/commit/60964834db5da3fc715a77c38ca375665ffaf04f)
- fix: Network ID list [`9c1e82c`](https://github.com/laduke/curly-octo-guacamole/commit/9c1e82cffa6438dc77fae80c9bdb95f592538251)

## v0.1.1 - 2024-02-12

### Commits

- feat: Initial commit [`4d05a59`](https://github.com/laduke/curly-octo-guacamole/commit/4d05a59dff7e169324d4827c6a4cb25f6066d24f)
- build: update repository url [`4e4238b`](https://github.com/laduke/curly-octo-guacamole/commit/4e4238b08715aeddb4d04c08ecbe1912c6b19173)
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ZeroTierOne API Spec
OpenAPI and JSON-schema for the [ZeroTierOne](https://github.com/zerotier/ZeroTierOne) service API.

This is the API that lets you leave and join networks on your local machine, or configure a self-hosted network controller.

The specs are generated from a [typespec](https://typespec.io/) spec.

## dev

``` sh
npm install
npm start
```

Open http://localhost:8080

## test
This integration test requires zerotier-one to be running. It may change configuration of your node! It runs in github actions too.

``` sh
AUTH_TOKEN=$(cat /path/to/authtoken.secret) npm test
```


## missing features
Features not implemented by typespec yet

- [ openapi examples ](https://github.com/microsoft/typespec/issues/2700)
- [ tag descriptions ](https://github.com/microsoft/typespec/issues/2220)


## publishing
How to create a github [release](https://github.com/zerotier/zerotier-one-api-spec/releases/).

Releases contain the openapi and json-schema files.

Try to use [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages if you want. They will appear in the changelog.

- Go into the repo's Github Actions
- Click "npm version && npm publish"
- Click Run Workflow
- Type "patch", "minor", or "major" and submit

On the CLI you can do:

``` sh
npm version {major,minor,patch}
npm run release
```

The url to the latest release of the openapi spec is: `https://github.com/zerotier/zerotier-one-api-spec/releases/latest/download/openapi.yaml`

Loading

0 comments on commit 9ae6d79

Please sign in to comment.