Skip to content

Commit d9249e9

Browse files
committed
Merge remote-tracking branch 'origin/23.1' into feat/unit-testing-23-1
2 parents a5a6bb4 + c57b9dd commit d9249e9

25 files changed

+455
-315
lines changed

.github/workflows/auth-react-test-1.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ on:
66
- opened
77
- reopened
88
- synchronize
9+
- labeled
10+
- unlabeled
911
push:
10-
tags:
11-
- dev-v[0-9]+.[0-9]+.[0-9]+
12+
branches:
13+
- "[0-9]+.[0-9]+"
1214

1315
# Only one instance of this workflow will run on the same ref (PR/Branch/Tag)
1416
# Previous runs will be cancelled.
@@ -18,11 +20,14 @@ concurrency:
1820

1921
jobs:
2022
define-versions:
23+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
2124
runs-on: ubuntu-latest
2225
outputs:
2326
fdiVersions: ${{ steps.versions.outputs.fdiVersions }}
2427
cdiVersions: ${{ steps.versions.outputs.cdiVersions }}
2528
nodeVersions: '["20"]'
29+
nodeFdiVersionMap: ${{ steps.node-versions.outputs.fdiVersions }}
30+
authReactFdiVersionMap: ${{ steps.auth-react-versions.outputs.fdiVersions }}
2631
steps:
2732
- uses: actions/checkout@v4
2833
- uses: supertokens/get-supported-versions-action@main
@@ -31,7 +36,22 @@ jobs:
3136
has-fdi: true
3237
has-cdi: true
3338

39+
- uses: supertokens/actions/get-versions-from-repo@main
40+
id: auth-react-versions
41+
with:
42+
repo: supertokens-auth-react
43+
github-token: ${{ secrets.GITHUB_TOKEN }}
44+
fdi-versions: ${{ steps.versions.outputs.fdiVersions }}
45+
46+
- uses: supertokens/actions/get-versions-from-repo@main
47+
id: node-versions
48+
with:
49+
repo: supertokens-node
50+
github-token: ${{ secrets.GITHUB_TOKEN }}
51+
fdi-versions: ${{ steps.versions.outputs.fdiVersions }}
52+
3453
setup-auth-react:
54+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
3555
runs-on: ubuntu-latest
3656
needs: define-versions
3757
strategy:
@@ -50,19 +70,20 @@ jobs:
5070
matrix: ${{ steps.setup-matrix.outputs.matrix }}
5171

5272
steps:
53-
- uses: supertokens/get-versions-action@main
73+
- name: Get node and auth-react versions for FDI
5474
id: versions
55-
with:
56-
driver-name: node
57-
fdi-version: ${{ matrix.fdi-version }}
58-
env:
59-
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}
75+
run: |
76+
nodeVersion=$( echo '${{ needs.define-versions.outputs.nodeFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]' )
77+
authReactVersion=$( echo '${{ needs.define-versions.outputs.authReactFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]' )
78+
79+
echo "nodeVersion=${nodeVersion}" >> $GITHUB_OUTPUT
80+
echo "authReactVersion=${authReactVersion}" >> $GITHUB_OUTPUT
6081
6182
- uses: supertokens/auth-react-testing-action/setup@main
6283
id: envs
6384
with:
64-
auth-react-version: ${{ steps.versions.outputs.authReactVersionXy }}
65-
node-sdk-version: ${{ steps.versions.outputs.nodeTag }}
85+
auth-react-version: ${{ steps.versions.outputs.authReactVersion }}
86+
node-sdk-version: ${{ steps.versions.outputs.nodeVersion }}
6687
fdi-version: ${{ matrix.fdi-version }}
6788

6889
- id: setup-matrix
@@ -74,6 +95,7 @@ jobs:
7495
spec: ${{ steps.envs.outputs.specs }}
7596
7697
launch-fdi-workflows:
98+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
7799
uses: ./.github/workflows/auth-react-test-2.yml
78100
needs:
79101
- define-versions

.github/workflows/auth-react-test-2.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ on:
3939

4040
jobs:
4141
retrieve-matrix:
42+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
4243
runs-on: ubuntu-latest
4344

4445
outputs:
@@ -54,6 +55,7 @@ jobs:
5455
echo "matrix=$matrix" | tee -a "$GITHUB_OUTPUT"
5556
5657
launch-test-workflows:
58+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
5759
needs:
5860
- retrieve-matrix
5961

.github/workflows/auth-react-test-3.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ on:
4444

4545
jobs:
4646
test:
47-
if: ${{ inputs.matrix != '{"include":[]}' }}
47+
if: inputs.matrix != '{"include":[]}' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests'))
4848
runs-on: ubuntu-latest
4949
strategy:
5050
max-parallel: 10

.github/workflows/backend-sdk-test.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ on:
66
- opened
77
- reopened
88
- synchronize
9+
- labeled
10+
- unlabeled
911
push:
10-
tags:
11-
- dev-v[0-9]+.[0-9]+.[0-9]+
12+
branches:
13+
- "[0-9]+.[0-9]+"
1214

1315
# Only one instance of this workflow will run on the same ref (PR/Branch/Tag)
1416
# Previous runs will be cancelled.
@@ -18,11 +20,13 @@ concurrency:
1820

1921
jobs:
2022
define-versions:
23+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
2124
runs-on: ubuntu-latest
2225
outputs:
2326
fdiVersions: ${{ steps.versions.outputs.fdiVersions }}
2427
cdiVersions: ${{ steps.versions.outputs.cdiVersions }}
2528
nodeVersions: '["20"]'
29+
coreCdiVersionMap: ${{ steps.core-versions.outputs.cdiVersions }}
2630
steps:
2731
- uses: actions/checkout@v4
2832
- uses: supertokens/get-supported-versions-action@main
@@ -31,7 +35,15 @@ jobs:
3135
has-fdi: true
3236
has-cdi: true
3337

38+
- uses: supertokens/actions/get-versions-from-repo@main
39+
id: core-versions
40+
with:
41+
repo: supertokens-core
42+
github-token: ${{ secrets.GITHUB_TOKEN }}
43+
cdi-versions: ${{steps.versions.outputs.cdiVersions }}
44+
3445
test:
46+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
3547
runs-on: ubuntu-latest
3648
needs: define-versions
3749

@@ -53,14 +65,12 @@ jobs:
5365
# Checking out to a custom path since the test repo will also be cloned
5466
path: supertokens-node
5567

56-
- uses: supertokens/get-versions-action@main
57-
id: versions
58-
with:
59-
driver-name: node
60-
cdi-version: ${{ matrix.cdi-version }}
61-
fdi-version: ${{ matrix.fdi-version }}
62-
env:
63-
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}
68+
- name: Get core version from current CDI version
69+
id: core-version
70+
run: |
71+
coreVersion=$(echo '${{ needs.define-versions.outputs.coreCdiVersionMap }}' | jq -r '.["${{ matrix.cdi-version }}"]')
72+
73+
echo "coreVersion=${coreVersion}" >> $GITHUB_OUTPUT
6474
6575
- uses: actions/setup-node@v4
6676
with:
@@ -70,7 +80,7 @@ jobs:
7080
working-directory: supertokens-node
7181
run: docker compose up --build --wait
7282
env:
73-
SUPERTOKENS_CORE_VERSION: ${{ steps.versions.outputs.coreVersionXy }}
83+
SUPERTOKENS_CORE_VERSION: ${{ steps.core-version.outputs.coreVersion }}
7484

7585
- name: Install SDK dependencies
7686
working-directory: supertokens-node

.github/workflows/check-docs.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: "Check if docs need an update"
2+
3+
on:
4+
push:
5+
branches:
6+
- "[0-9]+.[0-9]+"
7+
8+
permissions:
9+
contents: write
10+
11+
# Only one instance of this workflow will run on the same ref (PR/Branch/Tag)
12+
# Previous runs will be cancelled.
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
check-docs:
19+
name: Check if docs need an update
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.ref }}
26+
# Need a complete fetch to make the master merge check work
27+
fetch-depth: 0
28+
fetch-tags: true
29+
token: ${{ secrets.ALL_REPO_PAT }}
30+
31+
- name: Setup git
32+
run: |
33+
# NOTE: The user email is {user.id}+{user.login}@users.noreply.github.com.
34+
# See users API: https://api.github.com/users/github-actions%5Bbot%5D
35+
git config user.name "github-actions[bot]"
36+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
37+
git fetch origin master
38+
39+
- uses: actions/setup-node@v5
40+
with:
41+
node-version: 20
42+
43+
- name: Populate variables
44+
id: versions
45+
run: |
46+
. ./hooks/populate-hook-constants.sh
47+
48+
echo "packageVersion=$packageVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
49+
echo "packageVersionXy=$packageVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
50+
echo "packageLockVersion=$packageLockVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
51+
echo "packageLockVersionXy=$packageLockVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
52+
echo "newestVersion=$newestVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
53+
echo "targetBranch=$targetBranch" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
54+
55+
- name: Check tag and branch correctness
56+
run: |
57+
if [[ "${{ steps.versions.outputs.packageVersion }}" != "${{ steps.versions.outputs.packageLockVersion }}" ]]
58+
then
59+
echo "The package version and package lock version do not match."
60+
exit 1
61+
fi
62+
63+
if [[ "refs/heads/${{ steps.versions.outputs.packageVersion }}" != ${{ github.ref }}* ]]
64+
then
65+
echo "Branch name and package version mismatch"
66+
exit 1
67+
fi
68+
69+
- name: Install dependencies
70+
run: npm install
71+
72+
- name: Build docs
73+
run: |
74+
npm run build-pretty
75+
npm run build-docs
76+
77+
- name: Check for changes in docs and create a commit if necessary
78+
run: |
79+
git update-index --really-refresh
80+
81+
if git diff-index --quiet HEAD; then
82+
# No-op, docs are updated
83+
else
84+
# Update docs and create a commit on the branch
85+
git add --all
86+
git commit -nm "doc: update docs for v${{ steps.versions.outputs.packageVersion }} tag"
87+
git push
88+
fi

0 commit comments

Comments
 (0)