Skip to content

Commit

Permalink
Update publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
maxidragon authored and BaderBC committed Dec 21, 2023
2 parents ed41448 + 774546d commit aa64e7e
Show file tree
Hide file tree
Showing 70 changed files with 1,670 additions and 6 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy docs to GitHub Pages

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [19.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install
working-directory: ./docs
- name: Build
run: yarn build
working-directory: ./docs
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: gh-pages
folder: ./docs/build
18 changes: 14 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish to NPM
on:
release:
types: [created]
types: [published]
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -16,8 +16,18 @@ jobs:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies and build
run: npm run prepublish
- name: Publish package
run: npm publish
run: yarn && yarn prepublish
- name: Extract tag version
id: extract_tag
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
- name: Update version in package.json
run: |
npm --no-git-tag-version version ${{ steps.extract_tag.outputs.VERSION }}
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git commit -am "chore: bump version to ${{ steps.extract_tag.outputs.VERSION }}"
git push
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This project is loosely based on [Vulcan API](https://github.com/kapi2289/vulcan

## Docs

[Gitbook docs](https://capure.gitbook.io/vulcan-api-js/)
You can find the docs [here](https://avorty.github.io/vulcan-api-js)

## License

Expand Down
23 changes: 23 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Other package managers
pnpm-lock.yaml
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
8 changes: 8 additions & 0 deletions docs/docs/contributing/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Contributing",
"position": 5,
"link": {
"type": "generated-index",
"description": "Some details on how to contribute to the project."
}
}
11 changes: 11 additions & 0 deletions docs/docs/contributing/docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
sidebar_position: 3
---

# Contributing to the docs

On every page you can find a link to the source file of the page. You can edit the file and create a pull request.

## Docusaurus

Our documentation uses Docusaurus. If you want to learn about Markdown or special features of Docusaurus you can look at the [Docusaurus documentation](https://docusaurus.io/docs).
17 changes: 17 additions & 0 deletions docs/docs/contributing/general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
sidebar_position: 1
---

# General information

Contributions are welcome! We are happy to accept contributions in the form of pull requests, issues, or just general feedback and discussion.

## Contributing to the SDK

See [Contributing to the SDK](./sdk).

## Contributing to the documentation

See [Contributing to the documentation](./docs).

If you have any questions feel free to contact us.
23 changes: 23 additions & 0 deletions docs/docs/contributing/sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
sidebar_position: 2
---

# Contributing to the SDK

You can look on the [list of issues](https://github.com/avorty/vulcan-api-js/issues) and pick one to work on. If you have an idea for a new feature, you can create an issue and discuss it with us.

## Running SDK in the development mode

We use yarn as a package manager.

1. First install the dependencies

```bash
yarn install
```

2. Then run the SDK in development mode

```bash
yarn dev
```
11 changes: 11 additions & 0 deletions docs/docs/example_projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
sidebar_position: 4
---

# Example projects

Here is a list of example projects that use our SDK.

## BasedBook

BasedBook is a web application created by [Avorty](https://github.com/avorty) and it's a great example of how to use our SDK with Nest.js. See [backend repository](https://github.com/avorty/basedbook-backend).
8 changes: 8 additions & 0 deletions docs/docs/getting-started/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Getting started",
"position": 1,
"link": {
"type": "generated-index",
"description": "How to get started with the SDK"
}
}
28 changes: 28 additions & 0 deletions docs/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
sidebar_position: 1
---

# Installation

NPM
```bash
npm install vulcan-api-js
```

YARN
```bash
yarn add vulcan-api-js
```

PNPM
```bash
pnpm add vulcan-api-js
```

:::info
TypeScript typings are included.
:::

:::info
React Native is now supported, but you must install the react-native-get-random-values npm module and import it before the vulcan-api-js module.
:::
64 changes: 64 additions & 0 deletions docs/docs/getting-started/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
sidebar_position: 5
---

# Usage

First, you need to create a keystore, this is where your certificate is stored.

You will have to save it somewhere as that's what gets registered in Vulcan.

```js
const {Keystore} = require('vulcan-api-js');
const fs = require('fs');

const main = async () => {
const keystore = new Keystore();
await keystore.init();

fs.writeFileSync("keystore.json", keystore.dumpToJsonString(), { encoding: 'utf-8' });
};

main();
```

Then you will have to register the account.

```js
const {Keystore, AccountTools, registerAccount} = require('vulcan-api-js');
const fs = require('fs');

const main = async () => {
const keystore = new Keystore();
keystore.loadFromJsonString(fs.readFileSync("keystore.json", { encoding: 'utf-8' }));

const account = await registerAccount(keystore, {TOKEN}, {SYMBOL}, {PIN});
fs.writeFileSync("account.json", AccountTools.dumpToJsonString(account), { encoding: 'utf-8' });
};

main();
```

When you have your keystore and account generated, you can load them and use the SDK.

```js
const {Keystore, AccountTools, VulcanHebe} = require('vulcan-api-js');

const main = async () => {
const keystore = new Keystore();
keystore.loadFromJsonString(fs.readFileSync("keystore.json", { encoding: 'utf-8' }));

const client = new VulcanHebe(keystore, AccountTools.loadFromJsonString(fs.readFileSync("account.json", { encoding: 'utf-8' })));

// Pick your student (defaults to the first one)
await client.selectStudent();

// You can use the SDK here
};

main();
```

:::info
All the methods in the Vulcan API JS are async.
:::
8 changes: 8 additions & 0 deletions docs/docs/methods/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Methods",
"position": 2,
"link": {
"type": "generated-index",
"description": "All methods"
}
}
26 changes: 26 additions & 0 deletions docs/docs/methods/get_attendance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
sidebar_position: 9
---

# getAttendance

Gets attendace from a date range.

## Arguments

- (from) - [DateTime](../models/date_time)
- (to) - [DateTime](../models/date_time)

## Returns

This method will return an array of [Attendance](../models/attendance) objects with all attendance from the date range.

## Example

```js
client.getAttendance({from, to}).then(attendance => {
attendance.forEach(attendance => {
// attendance
})
})
```
25 changes: 25 additions & 0 deletions docs/docs/methods/get_exams.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
sidebar_position: 10
---

# getExams

Gets all exams since the last sync.

## Arguments

- (lastSync?) - Date

## Returns

This method will return an array of [Exam](../models/exam) objects with all exams since the last sync.

## Example

```js
client.getExams({lastSync}).then(exams => {
exams.forEach(exam => {
// exams
})
})
```
Loading

0 comments on commit aa64e7e

Please sign in to comment.