Skip to content

Commit 1f9b91e

Browse files
authored
Merge pull request #847 from jsonwebtoken/jt/upgrade-to-new-version
Project update to v2
2 parents 5b5dcb3 + d004bb8 commit 1f9b91e

File tree

655 files changed

+49530
-51063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

655 files changed

+49530
-51063
lines changed

.deployment-trigger

Lines changed: 0 additions & 1 deletion
This file was deleted.

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GITHUB_APP_ID=
2+
GITHUB_APP_PRIVATE_KEY=
3+
GITHUB_INSTALLATION_ID=

.env.sample

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.github/inactive/test.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/stale.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Vercel Preview Community Deployment
2+
env:
3+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4+
VERCEL_PROJECT_ID: ${{ secrets.PREVIEW_VERCEL_PROJECT_ID }}
5+
on:
6+
push:
7+
branches:
8+
- production
9+
jobs:
10+
Deploy-Production:
11+
runs-on:
12+
labels: ubuntu-latest
13+
steps:
14+
- name: Checkout the Codebase
15+
uses: actions/checkout@v4
16+
- name: Install Vercel CLI
17+
run: npm install --global vercel@latest
18+
- name: Deploy on Vercel
19+
id: deploy
20+
run: |
21+
vercel deploy --prod --token=${{ secrets.VERCEL_ACCESS_TOKEN }}

.github/workflows/preview.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Vercel Preview Deployment
2+
env:
3+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
5+
on:
6+
push:
7+
branches-ignore:
8+
- main
9+
- production
10+
jobs:
11+
Deploy-Preview:
12+
runs-on:
13+
labels: ubuntu-latest
14+
environment: preview
15+
outputs:
16+
deploymentUrl: ${{ steps.deploy.outputs.deploymentUrl }}
17+
steps:
18+
- name: Checkout the Codebase
19+
uses: actions/checkout@v4
20+
- name: Install Vercel CLI
21+
run: npm install --global vercel@latest
22+
- name: Deploy on Vercel
23+
id: deploy
24+
run: |
25+
vercel deploy --token=${{ secrets.VERCEL_ACCESS_TOKEN }} > deploy.log
26+
URL=$(cat deploy.log | grep -o 'https://[^ ]*.vercel.app' | head -n1)
27+
echo "deploymentUrl=$URL" >> $GITHUB_OUTPUT
28+
- name: Extract branch name
29+
shell: bash
30+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
31+
id: extract_branch
32+
- name: Assign Custom Domain
33+
if: ${{ steps.extract_branch.outputs.branch == 'remove-basepath-2' }}
34+
run: |
35+
vercel alias set --token=${{ secrets.VERCEL_ACCESS_TOKEN }} ${{ steps.deploy.outputs.deploymentUrl }} ab-test-next-jwt-io.vercel.app --scope=okta
36+
37+
Add-Comment:
38+
runs-on:
39+
labels: ubuntu-latest
40+
needs: Deploy-Preview
41+
permissions:
42+
issues: write
43+
pull-requests: write
44+
steps:
45+
- name: Comment URL to PR
46+
uses: actions/github-script@v6
47+
id: comment-deployment-url-script
48+
env:
49+
DEPLOYMENT_URL: ${{ needs.Deploy-Preview.outputs.deploymentUrl }}
50+
with:
51+
script: |
52+
// Get pull requests that are open for current ref.
53+
const pullRequests = await github.rest.pulls.list({
54+
owner: context.repo.owner,
55+
repo: context.repo.repo,
56+
state: 'open',
57+
head: `${context.repo.owner}:${context.ref.replace('refs/heads/', '')}`
58+
})
59+
60+
// Set issue number for following calls from context (if on pull request event) or from above variable.
61+
const issueNumber = context.issue.number || pullRequests.data[0].number
62+
63+
// Retrieve existing bot comments for the PR
64+
const {data: comments} = await github.rest.issues.listComments({
65+
owner: context.repo.owner,
66+
repo: context.repo.repo,
67+
issue_number: issueNumber,
68+
})
69+
const botComment = comments.find(comment => {
70+
return comment.user.type === 'Bot' && comment.body.includes('Preview URL at')
71+
})
72+
73+
const output = "Preview URL " + process.env.DEPLOYMENT_URL
74+
75+
// If we have a comment, update it, otherwise create a new one
76+
if (botComment) {
77+
github.rest.issues.updateComment({
78+
owner: context.repo.owner,
79+
repo: context.repo.repo,
80+
comment_id: botComment.id,
81+
body: output
82+
})
83+
} else {
84+
github.rest.issues.createComment({
85+
issue_number: issueNumber,
86+
owner: context.repo.owner,
87+
repo: context.repo.repo,
88+
body: output
89+
})
90+
}

.github/workflows/production.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Vercel Production Deployment
2+
env:
3+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
5+
on:
6+
push:
7+
branches:
8+
- main
9+
- production
10+
jobs:
11+
Deploy-Production:
12+
runs-on:
13+
labels: ubuntu-latest
14+
steps:
15+
- name: Checkout the Codebase
16+
uses: actions/checkout@v4
17+
- name: Install Vercel CLI
18+
run: npm install --global vercel@latest
19+
- name: Deploy on Vercel
20+
id: deploy
21+
run: |
22+
vercel deploy --prod --token=${{ secrets.VERCEL_ACCESS_TOKEN }}

.github/workflows/semgrep.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Semgrep
2+
3+
on:
4+
pull_request_target: {}
5+
push:
6+
branches: ["master", "main"]
7+
jobs:
8+
semgrep:
9+
name: Scan
10+
runs-on:
11+
labels: ubuntu-22.04-2cpu-8ram-75ssd
12+
container:
13+
image: returntocorp/semgrep
14+
if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot')
15+
steps:
16+
- uses: actions/checkout@v3
17+
- run: semgrep ci
18+
env:
19+
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}

0 commit comments

Comments
 (0)