Skip to content

Commit cbb8a46

Browse files
authored
Merge pull request #261 from 7Sageer/v2
Merge v2.0.0 to main
2 parents 7b47b45 + aecf70d commit cbb8a46

102 files changed

Lines changed: 15486 additions & 7342 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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
npm-debug.log
3+
dist
4+
.wrangler
5+
.git
6+
.gitignore
7+
Dockerfile
8+
vercel.json

.github/ISSUE_TEMPLATE/bug-反馈.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ assignees: ''
3737

3838
- [ ] 我提供的信息已经经过脱敏
3939

40-
- [x] 我确认没有找到解决相同问题的 issue
40+
- [ ] 我确认没有找到解决相同问题的 issue

.github/ISSUE_TEMPLATE/使用问题.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ assignees: ''
2929
## 尝试过的解决方案
3030
描述你已经尝试过的解决方法
3131

32-
- [x] 我确认没有找到解决相同问题的 issue
32+
- [ ] 我确认没有找到解决相同问题的 issue

.github/ISSUE_TEMPLATE/功能请求.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ assignees: ''
2121

2222
## 其他信息
2323

24-
- [x] 我已通过搜索确认没有类似issue
24+
- [ ] 我已通过搜索确认没有类似issue
2525

2626
- [ ] 我愿意提交PR来实现这个功能

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Deploy Worker
2+
23
on:
34
workflow_dispatch:
45
repository_dispatch:

.github/workflows/docker-image.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
paths:
11+
- 'Dockerfile'
12+
- 'docker-compose.yml'
13+
- 'src/**'
14+
- 'package.json'
15+
- 'package-lock.json'
16+
- '.github/workflows/docker-image.yml'
17+
workflow_dispatch:
18+
19+
jobs:
20+
docker:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
35+
- name: Prepare image name
36+
id: image
37+
run: echo "name=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
38+
shell: bash
39+
40+
- name: Docker metadata
41+
id: meta
42+
uses: docker/metadata-action@v5
43+
with:
44+
images: ${{ steps.image.outputs.name }}
45+
tags: |
46+
type=ref,event=branch
47+
type=ref,event=tag
48+
type=sha
49+
type=raw,value=latest,enable={{is_default_branch}}
50+
51+
- name: Login to GHCR
52+
if: github.event_name != 'pull_request'
53+
uses: docker/login-action@v3
54+
with:
55+
registry: ghcr.io
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Build and push
60+
uses: docker/build-push-action@v5
61+
with:
62+
context: .
63+
platforms: linux/amd64,linux/arm64
64+
push: ${{ github.event_name != 'pull_request' }}
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # Trigger on version tags like v2.0.1
7+
8+
permissions:
9+
contents: write # Required to create releases
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0 # Fetch all history for changelog generation
19+
20+
- name: Extract version from tag
21+
id: version
22+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
23+
24+
- name: Create GitHub Release
25+
uses: softprops/action-gh-release@v1
26+
with:
27+
name: Sublink Worker ${{ steps.version.outputs.VERSION }}
28+
body: |
29+
## Release ${{ steps.version.outputs.VERSION }}
30+
31+
### 📚 Documentation
32+
- [Complete Changelog](https://www.sublink.works/updates/)
33+
- [Deployment Guide](https://www.sublink.works/guide/)
34+
- [API Documentation](https://www.sublink.works/api/)
35+
36+
### 🚀 Quick Start
37+
```bash
38+
# Cloudflare Workers
39+
npm install && npm run deploy
40+
41+
# Docker
42+
docker compose up -d
43+
44+
# Node.js
45+
npm run build:node && npm run dev:node
46+
```
47+
48+
---
49+
**Note:** This release was automatically created by GitHub Actions.
50+
For detailed changes, see the [changelog](https://www.sublink.works/updates/).
51+
generate_release_notes: true # Auto-generate notes from commits
52+
draft: false
53+
prerelease: false
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Notify success
58+
if: success()
59+
run: |
60+
echo "✅ Release ${{ steps.version.outputs.VERSION }} created successfully!"
61+
echo "View at: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.version.outputs.VERSION }}"

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test Worker
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '21'
19+
20+
- name: Install dependencies
21+
run: npm install
22+
23+
- name: Run tests
24+
run: npm test

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ dist
171171
.dev.vars
172172
.wrangler/
173173

174-
test
175174
.editorconfig
176175
.prettierrc
177-
package-lock.json
176+
.vercel

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:20-alpine AS builder
2+
WORKDIR /app
3+
4+
COPY package*.json ./
5+
COPY pnpm-lock.yaml pnpm-lock.yaml
6+
RUN npm install
7+
8+
COPY src ./src
9+
COPY public ./public
10+
COPY docs ./docs
11+
12+
RUN npm run build:node
13+
14+
FROM node:20-alpine AS runner
15+
WORKDIR /app
16+
17+
ENV NODE_ENV=production
18+
ENV PORT=8787
19+
20+
COPY --from=builder /app/dist ./dist
21+
COPY public ./public
22+
23+
EXPOSE 8787
24+
25+
CMD ["node", "dist/node-server.cjs"]

0 commit comments

Comments
 (0)