Skip to content

Commit

Permalink
Merge branch 'master' of github.com:deriv-com/deriv-api-docs into fea…
Browse files Browse the repository at this point in the history
…ture/integrate-translations
  • Loading branch information
shafin-deriv committed Aug 5, 2024
2 parents ca06458 + 1a133f7 commit a4a08a2
Show file tree
Hide file tree
Showing 16 changed files with 465 additions and 129 deletions.
31 changes: 11 additions & 20 deletions .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,19 @@ jobs:
with:
name: build
path: build
- name: Publish to Docker
id: publish_to_docker
uses: ./.github/actions/publish_to_docker
- name: Upload to vercel
uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master'
id: publish_to_vercel
with:
DOCKER_LATEST_IMAGE_TAG: 'latest'
DOCKER_IMAGE_TAG: ${{ github.ref_name }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Deploy to Kubernetes
id: deploy_to_kubernetes
uses: ./.github/actions/deploy_to_kubernetes
with:
K8S_VERSION: ${{ github.ref_name }}
K8S_NAMESPACE: 'deriv-com-api-production'
CA_CRT: ${{ secrets.CA_CRT }}
SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }}
KUBE_SERVER: ${{ secrets.KUBE_SERVER }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
ENVIRONMENT: Production
VERCEL_SCOPE: deriv
ALIAS_DOMAIN_URL: 'api-docs-dr.binary.sx'
- name: Send Slack Notification
if: ${{ steps.publish_to_docker.outcome != 'success' || steps.deploy_to_kubernetes.outcome != 'success' }}
if: always() && ${{ steps.publish_to_vercel.outcome != 'success'}}
uses: ./.github/actions/notify_slack
with:
RELEASE_TYPE: ${{ env.RELEASE_TYPE }}
MESSAGE: "'${{ env.RELEASE_TYPE }}' Release succeeded for api.deriv.com with version *'${{ needs.build_and_publish.outputs.RELEASE_VERSION }}'* has Failed *"
MESSAGE: "Publish to vercel failed for '${{ env.RELEASE_TYPE }}' release on api.deriv.com with version *'${{ needs.build_and_publish.outputs.RELEASE_VERSION }}"
9 changes: 9 additions & 0 deletions .github/workflows/release_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,12 @@ jobs:
SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }}
KUBE_SERVER: ${{ secrets.KUBE_SERVER }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
- name: Upload to vercel
uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master'
with:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
ENVIRONMENT: Preview
VERCEL_SCOPE: deriv
ALIAS_DOMAIN_URL: 'staging-api-docs-dr.binary.sx'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ yarn-error.log*

.idea

.vscode/settings.json
.vscode/settings.json
.vercel
200 changes: 96 additions & 104 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,150 +1,142 @@
<h1 align="center">Deriv API</h1>
# Deriv API

This repository contains the information and code related to the Deriv API documentation.
![Prerequisite](https://img.shields.io/badge/node-18.x-blue.svg)
![Prerequisite](https://img.shields.io/badge/npm-10.x-orange.svg)
![Prerequisite](https://img.shields.io/badge/docusaurus-3.x-darkgreen.svg)
![Prerequisite](https://img.shields.io/badge/@deriv/ui-0.8.x-red.svg)

![Prerequisite](https://img.shields.io/badge/node-%3E%3D16.16.0-blue.svg)
[![Coverage Status](https://coveralls.io/repos/github/binary-com/deriv-api-docs/badge.svg?branch=master)](https://coveralls.io/github/binary-com/deriv-api-docs?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/deriv-com/deriv-api-docs/badge.svg?branch=master)](https://coveralls.io/github/deriv-com/deriv-api-docs?branch=master)

<!--
![CircleCI](https://img.shields.io/circleci/build/github/binary-com/deriv-api-docs)
![Sonar Tech Debt](https://img.shields.io/sonar/tech_debt/binary-com_deriv-app?server=https%3A%2F%2Fsonarcloud.io)
![Sonar Violations (short format)](https://img.shields.io/sonar/violations/binary-com_deriv-app?server=https%3A%2F%2Fsonarcloud.io) -->
## Description

**In this document**:
Welcome to the official API documentation for Deriv. Here, you will find comprehensive guides and documentation to help you start working with our APIs as quickly as possible, as well as support if you get stuck. Let's jump right in!

- [Other Documents](#other-documents)
- [Pre-installation](#Pre-installation)
- [Quick start](#Quick-start)
- [Packages](#packages)
- [Working With This Repo](#working-with-this-repo)
- [Package names](#package-names)
- [Usage](#usage)
- [Starting a Development Server](#starting-a-dev-server)
- [Release](#release)
- [PR Guidelines](#pr-guidelines)
## Quick Access

## Other documents:
- [Prerequisite](#Prerequisite)
- [Setup Guide](#Setup-Guide)
- [Clone](#clone-the-project)
- [Install Dependencies](#install-dependencies)
- [Production Build](#build-the-project)
- [How to Contribute](#How-to-Contribute)
- [Fork Repository](#fork--clone-project)
- [Configure Origin & Upstream](#configure-origin--upstream)
- [Branching and Pull Request Guidelines](#Branching-and-Pull-Request-Procedure)
- [Project Structure](#Project-Structure)

- [General](docs/README.md) - Contains general philosophy and overview of this package
## Prerequisite

## Pre-installation
To ensure smooth running and contribution to this project, please make sure you have the following packages installed in your environment:

Before running or contributing to this project, you need to install the following packages for your environment
| Tool | Version | Reference |
| ---- | --------- | ---------------------------------------------------------- |
| Node | >=18.20.0 | [Download](https://nodejs.org/en/download/package-manager) |
| npm | >=10.7.0 | - |
| Git | - | [Download](https://git-scm.com/downloads) |

- node >=16.16.0
- npm >=7.21.0
- docusaurus >=2.0.0
- @deriv/ui >=0.1.0
- git (for `contribution`)
- docker-cli
**Note**: Ensure that `node -v` and `sudo node -v` show the same version.

**Note**: `node -v` and `sudo node -v` should be the same version.
## Setup Guide

## Quick start
### Clone the Project

1. **Fork the project**
git clone [email protected]:deriv-com/deriv-api-docs.git

In order to work on your own version of the Deriv application, please fork the project to your own repository.
### Install Dependencies

2. **Clone using SSH**
npm ci // Clean Install

```sh
git clone [email protected]:binary-com/deriv-api-docs.git
```
or

3. **Enter project directory**
npm i // Install

```sh
cd deriv-api-docs
```
### Run the Project

4. **Install your dependencies:**
After successfully building the project, you can execute or debug it using the Terminal by running the following command.

```sh
npm ci
```
npm run start:dev

5. **Build the project:**
### Build the Project

```sh
npm run build
```

6. **Run the Build**
Run proxy server in seperate terminal

```sh
npm run start:auth
```

After that, start the application in another terminal

```sh
npm run start
```

<br />

### Starting a Development Server

1. Core:
## How to Contribute

If you wish to work on Core, simply run `npm run start`.
If you are a developer and want to contribute to the repository, please follow the procedure below.

2. Netlify Proxy + Core :
### Fork & Clone Project

1. To work on cms configs, run:
To create your own version of the Deriv API application, you need to `fork` the project to your own GitHub repository. Follow these steps to `fork` a repository:

```sh
npm run start:auth
```
1. Go to the GitHub page of the repository you want to `fork`.
2. Click on the "`Fork`" button at the top right corner of the page.
3. Choose the `GitHub account` where you want to fork the repository.
4. Wait for the forking process to finish. Once it's done, you will be redirected to your forked repository.
5. Now, clone the repository by running the command `git clone [email protected]:[username]/deriv-api-docs.git`.

2. In a separate terminal, this will start the netlify-cms-proxy-server and will enable you to work with the cms locally.
and then run:
**Note**: Replace `[username]` with your username to clone the forked repository. Also, to clone the repository, set up SSH on GitHub to authorize your system to clone and perform git operations. Please refer to this [documentation](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).

```sh
npm run start
```
6. Start contributing by installing the necessary dependencies. You can find instructions on how to install dependencies [here](#install-dependencies).

<br />
### Configure Origin & Upstream

## How to Contribute
Once you clone the project, before committing any changes, you need to set up a few things for git `email` and `username`. Additionally, if you want to push your code, you need to set up the origin and upstream to connect with the main repository `deriv-api` in `deriv-com`.

PRs are based on the master branch
To set up the origin, use the following command in the Terminal:

1. Create branch from the latest master branch
git remote add origin [origin URL]

```sh
git checkout master
git pull upstream master
git checkout -b [_your_branch_name]
```
Replace `[origin URL]` with the git repository URL of your repository. Now, after setting up the origin, you need to add the `upstream`. To do that, use the following command:

2. Make your changes
git remote add upstream [upstream URL]

3. Make pull request
Replace `[upstream URL]` with the git repository URL for the main [repository](https://github.com/deriv-com/deriv-api-docs.git).

- Push your changes to your origin
### Branching and Pull Request Procedure

```sh
git push -u origin [_your_branch_name]
```
To create a branch from the latest master branch, follow these steps:

## Release
1. Switch to the master branch using the command `git checkout master`.
2. Pull the latest changes from the upstream master branch using the command `git pull upstream master`.
3. Create a new branch with your desired branch name using the command `git checkout -b [your_branch_name]`.
4. Push your changes to the origin branch using the command `git push origin [your_branch_name]`.

There are 2 types of release:
### Project Structure

1. Release to staging:
1. `git tag staging_v20191205 -m 'release staging'` # the tag needs to follow the RegExp format `/^staging.*/`
2. `git push origin staging_v20191205`
2. Release to production:
1. `git tag production_v20191205 -m 'release production'`
2. `git push origin production_v20191205`
This application is developed using `Docusaurus`, which follows a specific project structure to organize and manage documentation websites. The typical project structure includes the following directories and files:

<br />
**Example:**

## Test link deployment
├── docs
| ├── Code Example
| | ├── Javascript
| ├── Core Concepts
| | ├── Web Sockets
| ├── Frameworks
| ...
|
├── src
| ├── components
| ├── configs
| ├── features
| ├── hooks
| ├── context
| ├── pages
| ├── theme
| ├── styles
| ...
|
├── static
| ├── img
|
├── config
| ├── v3
|
├── docusaurus.config.js
├── readme.md
├── package.json
...

Upon creating PR, [Vercel](https://vercel.com/) will auto-generate a test link inside the PR. you can use that to preview the test link for the changes you have made.
**_Note_**:

<br />
In the root of the project, there is a folder called `Config/v3`. This folder is managed by the `Backend Team` through workflow and contains configurations used in the `API Explorer` page for API request and response values and data. The `Frontend Team` does `not` need to modify this folder.
2 changes: 1 addition & 1 deletion config/v3/confirm_email/send.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"verification_code": {
"description": "Email verification code (received from a `verify_email` call, which must be done first).",
"type": "string",
"pattern": "^\\w{6,128}$",
"pattern": "^\\w{8,128}$",
"sensitive": 1
},
"passthrough": {
Expand Down
34 changes: 34 additions & 0 deletions config/v3/kyc_auth_status/receive.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,23 @@
}
}
}
},
"supported_documents_override": {
"description": "Supported documents override per service.",
"type": "object",
"properties": {
"manual": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"display_name": {
"type": "string"
}
}
}
}
}
}
}
}
Expand Down Expand Up @@ -318,6 +335,23 @@
}
}
}
},
"supported_documents_override": {
"description": "Supported documents override per service.",
"type": "object",
"properties": {
"manual": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"display_name": {
"type": "string"
}
}
}
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion config/v3/new_account_virtual/send.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
"verification_code": {
"description": "Email verification code (received from a `verify_email` call, which must be done first).",
"type": "string",
"pattern": "^\\w{6,128}$"
"pattern": "^\\w{8,128}$"
},
"loginid": {
"description": "[Optional] The login id of the user. Mandatory when multiple tokens were provided during authorize.",
Expand Down
Loading

0 comments on commit a4a08a2

Please sign in to comment.