Skip to content

Commit a64cbc0

Browse files
authored
Merge pull request #968 from supertokens/chore/fix-ci
chore: Migrate CI to github actions
2 parents 43d0864 + 9756d21 commit a64cbc0

File tree

9 files changed

+161
-138
lines changed

9 files changed

+161
-138
lines changed

.circleci/config.yml

-130
This file was deleted.

.github/workflows/build.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "docs/**"
7+
- "static/**"
8+
- "src/**"
9+
- "package-lock.json"
10+
push:
11+
branches:
12+
- master
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
cache: "npm"
25+
cache-dependency-path: "package-lock.json"
26+
27+
- name: Install Dependencies
28+
run: npm install
29+
30+
- name: Build Docusaurus Site
31+
run: npm run build
32+
33+
- name: Upload Build Artifacts
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: docusaurus-build
37+
path: build
38+
retention-days: 1
39+
40+
trigger:
41+
needs: build
42+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Trigger Workflow in Different Repository
46+
uses: actions/github-script@v7
47+
with:
48+
github-token: ${{ secrets.BACKEND_WEBSITE_TOKEN }}
49+
script: |
50+
github.rest.actions.createWorkflowDispatch({
51+
owner: 'supertokens',
52+
repo: 'supertokens-backend-website',
53+
workflow_id: 'release-documentation-changes.yml',
54+
ref: 'master',
55+
inputs: {
56+
"run-id": `${{ github.run_id }}`,
57+
}
58+
})

.github/workflows/lint.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Lint Docs
2+
3+
on:
4+
# Need to fix mdx issues that appeared in the latest version of vale
5+
# pull_request:
6+
workflow_dispatch:
7+
# paths:
8+
# - "docs/**"
9+
# - ".vale.ini"
10+
11+
jobs:
12+
vale-lint:
13+
runs-on: ubuntu-latest
14+
container:
15+
image: jdkato/vale
16+
steps:
17+
- uses: actions/checkout@v4
18+
- run: vale --version
19+
20+
- name: Run Vale Linting
21+
run: vale --minAlertLevel=error --config=.vale.ini ./docs

.github/workflows/type-checking.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Code Type Checking
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- "docs/**"
8+
9+
jobs:
10+
write-code-blocks:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: oven-sh/setup-bun@v2
16+
17+
- name: Install Dependencies
18+
run: bun install
19+
20+
- name: Write Code Snippets
21+
run: bun run write-code-blocks
22+
23+
- name: Upload Code Type Checking Scripts
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: code-blocks
27+
path: scripts/code-type-checking
28+
retention-days: 1
29+
30+
code-type-checking:
31+
needs: write-code-blocks
32+
runs-on: ubuntu-latest
33+
strategy:
34+
matrix:
35+
language:
36+
- javascript
37+
- go
38+
- python
39+
- swift
40+
- php
41+
- java
42+
- csharp
43+
# TODO: Check kotlin issues
44+
# - kotlin
45+
steps:
46+
- name: Download Code Blocks
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: code-blocks
50+
path: ./scripts/code-type-checking
51+
52+
- uses: docker/setup-buildx-action@v3
53+
54+
- name: Check code snippets for ${{ matrix.language }}
55+
working-directory: ./scripts/code-type-checking/${{ matrix.language }}
56+
run: docker build -t code-check-${{ matrix.language }} .

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ scripts/code-type-checking/go/snippets/*
3131
scripts/code-type-checking/php/snippets/*
3232
scripts/code-type-checking/csharp/snippets/*
3333
scripts/code-type-checking/javascript/snippets/*
34+
scripts/code-type-checking/javascript/node_modules
3435
scripts/code-type-checking/kotlin/snippets/*
3536
scripts/code-type-checking/java/snippets/*
3637
scripts/code-type-checking/python/snippets/*

.vale.ini

-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22
StylesPath = .vale
33
MinAlertLevel = suggestion
44

5-
Packages = MDX
65
Vocab = Authentication
76

87

9-
[formats]
10-
mdx = md
11-
128
[*.{md,mdx}]
139
BasedOnStyles = SuperTokens
1410

docs/additional-verification/attack-protection-suite/introduction.mdx

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
sidebar_position: 1
33
title: Introduction
44
hide_title: true
5-
description: >-
6-
Enhance application security with SuperTokens Attack Protection Suite's
7-
advanced threat detection methods.
5+
description: Enhance application security with automatic threat detection SuperTokens
86
---
97

108
# Introduction

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"typecheck": "tsc",
1818
"write-code-blocks": "bun run ./scripts/write-code-blocks.ts",
1919
"format-code-blocks": "bun run ./scripts/format-code-blocks.ts",
20-
"check-code-blocks": "./scripts/check-code-blocks.sh",
20+
"check-code-blocks": "bun run ./scripts/check-code-blocks.ts",
2121
"ai": "bun run scripts/ai.ts"
2222
},
2323
"dependencies": {

scripts/check-code-blocks.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { $ } from "bun";
2+
3+
async function runCodeTypeCheck(language: string) {
4+
if (!language) {
5+
console.error("Please provide a language argument");
6+
process.exit(1);
7+
}
8+
console.log(language);
9+
10+
try {
11+
const { exitCode } = await $`docker build -t code-check-${language} .`.cwd(
12+
`./scripts/code-type-checking/${language}`,
13+
);
14+
15+
process.exit(exitCode);
16+
} catch (error) {
17+
console.error("Error running code type check:", error);
18+
process.exit(1);
19+
}
20+
}
21+
22+
const language = process.argv[2];
23+
runCodeTypeCheck(language);

0 commit comments

Comments
 (0)