Skip to content

Commit 76338e5

Browse files
committed
Initial public release
0 parents  commit 76338e5

404 files changed

Lines changed: 49403 additions & 0 deletions

File tree

Some content is hidden

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

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist/
2+
webapp/_webapp/node_modules/
3+
webapp/_webapp/dist/
4+
.env

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OPENAI_API_KEY=dummy-key
2+
PD_MONGO_URI="mongodb://localhost:27017"

.github/ISSUE_TEMPLATE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!--
2+
3+
Note: If you are using www.overleaf.com and have a problem,
4+
or if you would like to request a new feature please contact
5+
the support team at support@overleaf.com
6+
7+
This form should only be used to report bugs in the
8+
Community Edition release of Overleaf.
9+
10+
-->
11+
12+
13+
14+
<!-- BUG REPORT TEMPLATE -->
15+
16+
## Steps to Reproduce
17+
<!-- Describe the steps leading up to when / where you found the bug. -->
18+
<!-- Screenshots may be helpful here. -->
19+
20+
1.
21+
2.
22+
3.
23+
24+
## Expected Behaviour
25+
<!-- What should have happened when you completed the steps above? -->
26+
27+
## Observed Behaviour
28+
<!-- What actually happened when you completed the steps above? -->
29+
<!-- Screenshots may be helpful here. -->
30+
31+
## Context
32+
<!-- How has this issue affected you? What were you trying to accomplish? -->
33+
34+
## Technical Info
35+
<!-- Provide any technical details that may be applicable (or N/A if not applicable). -->
36+
37+
* URL:
38+
* Browser Name and version:
39+
* Operating System and version (desktop or mobile):
40+
* Signed in as:
41+
* Project and/or file:
42+
43+
## Analysis
44+
<!--- Optionally, document investigation of / suggest a fix for the bug, e.g. 'comes from this line / commit' -->

.github/workflows/build.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build Beta Chrome Extension
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- 'Bump Version'
7+
types:
8+
- completed
9+
jobs:
10+
build-chrome-extension:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # 获取完整历史
18+
19+
- name: Setup node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: lts/*
23+
24+
- name: Build
25+
run: |
26+
cd webapp/_webapp
27+
npm install
28+
npm run build:stg:chrome
29+
30+
- name: 👉 Upload artifacts
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: paperdebugger-chrome-extension-stg
34+
path: webapp/_webapp/dist
35+
36+
push-to-chrome-web-store:
37+
runs-on: ubuntu-latest
38+
needs: build-chrome-extension
39+
steps:
40+
- name: Install zip
41+
run: |
42+
sudo apt-get update && sudo apt-get install -y zip
43+
44+
- name: Download artifacts
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: paperdebugger-chrome-extension-stg
48+
path: dist
49+
50+
- name: Zip extension files
51+
run: |
52+
zip -r dist.zip dist/*
53+
54+
- name: Upload to Chrome Web Store (upload only)
55+
uses: mobilefirstllc/cws-publish@latest
56+
with:
57+
action: 'upload' # one of: upload, publish, testers
58+
client_id: ${{ secrets.CHROME_EXT_CLIENT_ID }}
59+
client_secret: ${{ secrets.CHROME_EXT_CLIENT_SECRET }}
60+
refresh_token: ${{ secrets.CHROME_EXT_REFRESH_TOKEN }}
61+
extension_id: 'gjkgbnnlfophcfffoinfgdnhjnfankbn'
62+
zip_file: 'dist.zip'
63+
continue-on-error: true

.github/workflows/bump-version.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Bump Version
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
bump-version:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # 获取完整历史
18+
19+
- name: Find nearest version tag
20+
id: get_tag
21+
run: |
22+
tag=$(git describe --tags --match "v*" --abbrev=0)
23+
24+
echo "Found tag: $tag"
25+
echo "tag=$tag" >> $GITHUB_OUTPUT
26+
27+
- name: Bump patch version
28+
id: bump
29+
run: |
30+
tag="${{ steps.get_tag.outputs.tag }}"
31+
# Remove v prefix
32+
version="${tag#v}"
33+
34+
# Use awk or bash logic to increment the last digit
35+
IFS='.' read -r -a parts <<< "$version"
36+
last_index=$((${#parts[@]} - 1))
37+
parts[$last_index]=$((parts[$last_index] + 1))
38+
39+
# Reassemble
40+
new_version="${parts[0]}"
41+
for i in $(seq 1 $last_index); do
42+
new_version="${new_version}.${parts[$i]}"
43+
done
44+
45+
new_tag="v${new_version}"
46+
echo "Bumped tag: $new_tag"
47+
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
48+
49+
- name: Create and push new tag
50+
run: |
51+
git config user.name "github-actions[bot]"
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
git tag "${{ steps.bump.outputs.new_tag }}"
54+
git push origin "${{ steps.bump.outputs.new_tag }}"
55+
56+
# TODO: use peter-evans/workflow-dispatch@v1 to dispatch build workflow, passing the new version so that the build workflow can use it without re-clone the whole repo

.github/workflows/lint-pr.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Lint"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: read
12+
13+
jobs:
14+
lint-pr:
15+
name: Lint PR
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@v5
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
jobs:
7+
build-chrome-extension:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
- name: Setup env
13+
run: |
14+
echo "MONOREPO_REVISION=$(git rev-parse HEAD | cut -c1-6)" >> $GITHUB_ENV
15+
echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
16+
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
17+
- name: Setup node
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: lts/*
21+
- name: Build
22+
run: |
23+
export PD_API_ENDPOINT=https://app.paperdebugger.com
24+
export BETA_BUILD=false
25+
cd webapp/_webapp
26+
npm install
27+
npm run build
28+
- name: 👉 Upload artifacts
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: paperdebugger-chrome-extension-prd
32+
path: paperdebugger/webapp/_webapp/dist
33+
34+
- name: Install zip
35+
run: |
36+
sudo apt-get update && sudo apt-get install -y zip
37+
- name: Zip extension files
38+
run: |
39+
zip -r dist.zip webapp/_webapp/dist/*
40+
- name: Upload to Chrome Web Store (upload only)
41+
uses: mobilefirstllc/cws-publish@latest
42+
with:
43+
action: 'upload' # one of: upload, publish, testers
44+
client_id: ${{ secrets.CHROME_EXT_CLIENT_ID }}
45+
client_secret: ${{ secrets.CHROME_EXT_CLIENT_SECRET }}
46+
refresh_token: ${{ secrets.CHROME_EXT_REFRESH_TOKEN }}
47+
extension_id: 'dfkedikhakpapbfcnbpmfhpklndgiaog'
48+
zip_file: 'dist.zip'
49+
build-and-push:
50+
runs-on: ubuntu-latest
51+
permissions:
52+
contents: read
53+
packages: write
54+
outputs:
55+
IMAGE_TAG: ${{ steps.output.outputs.IMAGE_TAG }}
56+
PAPERDEBUGGER_IMAGE: ${{ steps.output.outputs.PAPERDEBUGGER_IMAGE }}
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v4
60+
- name: Setup env
61+
run: |
62+
echo "MONOREPO_REVISION=$(git rev-parse HEAD | cut -c1-6)" >> $GITHUB_ENV
63+
echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
64+
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
65+
- name: Log in to the container registry
66+
uses: docker/login-action@v3
67+
with:
68+
registry: ghcr.io
69+
username: ${{ github.actor }}
70+
password: ${{ secrets.GITHUB_TOKEN }}
71+
- name: Build and push docker image
72+
run: |
73+
make all
74+
- id: output
75+
name: Output image tag
76+
run: |
77+
export IMAGE_TAG=${BRANCH_NAME}-${MONOREPO_REVISION}
78+
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT
79+
echo "PAPERDEBUGGER_IMAGE=ghcr.io/paperdebugger/sharelatex-paperdebugger:${IMAGE_TAG}" >> $GITHUB_OUTPUT
80+
81+
deploy:
82+
needs: build-and-push
83+
runs-on: ubuntu-latest
84+
permissions:
85+
contents: write
86+
steps:
87+
- name: Checkout repository
88+
uses: actions/checkout@v4
89+
- name: Clone deploy repo
90+
run: |
91+
git clone https://${{ secrets.GH_PAT }}@github.com/paperdebugger/deploy.git ../deploy
92+
- name: Generate kubernetes manifests
93+
env:
94+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY_PRD }}
95+
MCP_BASIC_KEY: ${{ secrets.MCP_BASIC_KEY_PRD }}
96+
MCP_PAPERSCORE_KEY: ${{ secrets.MCP_PAPERSCORE_KEY_PRD }}
97+
MONGO_URI: ${{ secrets.MONGO_URI_PRD }}
98+
GHCR_DOCKER_CONFIG: ${{ secrets.GHCR_DOCKER_CONFIG_PRD }}
99+
CLOUDFLARE_TUNNEL_TOKEN: ${{ secrets.CLOUDFLARE_TUNNEL_TOKEN_PRD }}
100+
run: |
101+
export PAPERDEBUGGER_IMAGE=${{ needs.build-and-push.outputs.PAPERDEBUGGER_IMAGE }}
102+
mkdir -p ../deploy/prd
103+
./hack/prd.sh > ../deploy/prd/paperdebugger.yaml
104+
- name: Push changes to deploy repo
105+
run: |
106+
export IMAGE_TAG=${{ needs.build-and-push.outputs.IMAGE_TAG }}
107+
cd ../deploy
108+
git config --global user.name "github-actions[bot]"
109+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
110+
git add prd/paperdebugger.yaml
111+
git diff --staged --quiet || git commit -m "chore: update paperdebugger prd, revision ${IMAGE_TAG}"
112+
git push

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# docker image build
2+
.dockerignore
3+
node_modules
4+
5+
# user defined files
6+
.env
7+
docker-compose.override.yml
8+
node_modules
9+
.DS_Store
10+
11+
# If you prefer the allow list template instead of the deny list, see community template:
12+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
13+
#
14+
# Binaries for programs and plugins
15+
*.exe
16+
*.exe~
17+
*.dll
18+
*.so
19+
*.dylib
20+
.DS_Store
21+
__debug*
22+
node_modules
23+
# Test binary, built with `go test -c`
24+
*.test
25+
26+
# Output of the go coverage tool, specifically when used with LiteIDE
27+
*.out
28+
29+
# Dependency directories (remove the comment below to include it)
30+
# vendor/
31+
32+
# Go workspace file
33+
go.work
34+
go.work.sum
35+
36+
# IDE
37+
.vscode/*
38+
!/.vscode/launch.json
39+
!/.vscode/settings.json
40+
.idea
41+
42+
# output
43+
dist/
44+
data/
45+
tmp/
46+
47+
overleaf.kubeconfig
48+
!.dockerignore
49+
50+
# coverage report
51+
coverage.out
52+
coverage.html

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Golang Debug",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${workspaceFolder}/cmd/main.go",
13+
"env": {
14+
"PD_MONGO_URI": "mongodb://localhost:27017", // expose the port using k9s
15+
},
16+
"console": "integratedTerminal"
17+
},
18+
]
19+
}

0 commit comments

Comments
 (0)