forked from zizifn/edgetunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cf worker hello world project and enable deploy via GITHUB action (…
…zizifn#78) add cf worker hello world project and enable deploy via GITHUB action
- Loading branch information
Showing
13 changed files
with
16,600 additions
and
11,427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: cf-worker-deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- test-cf | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: CF | ||
name: Deploy | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: envsubst | ||
run: | | ||
envsubst < apps/cf-worker-vless/wrangler.toml.tp > apps/cf-worker-vless/wrangler.toml | ||
if [[ $CUSTOM_DOMAIN ]]; then | ||
echo cf_environment="custom" >> $GITHUB_ENV | ||
else | ||
echo "not set CUSTOM_DOMAIN" | ||
fi | ||
env: | ||
CUSTOM_DOMAIN: ${{ secrets.CUSTOM_DOMAIN }} | ||
- name: Publish | ||
uses: cloudflare/wrangler-action@2.0.0 | ||
with: | ||
apiToken: ${{ secrets.CF_API_TOKEN }} | ||
command: publish --env ${{ env.cf_environment || 'default' }} | ||
workingDirectory: 'apps/cf-worker-vless' | ||
environment: ${{ env.cf_environment || 'default' }} | ||
secrets: | | ||
UUID | ||
env: | ||
UUID: ${{ secrets.UUID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,6 @@ Thumbs.db | |
**/config-local.json | ||
|
||
**/.env | ||
|
||
**/.dev.vars | ||
**/wrangler.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "cf-worker-vless", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/cf-worker-vless/src", | ||
"projectType": "application", | ||
"targets": { | ||
"serve": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "wrangler dev", | ||
"cwd": "apps/cf-worker-vless" | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nrwl/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["apps/cf-worker-vless/**/*.ts"] | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const environment = { | ||
production: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const environment = { | ||
production: false, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default { | ||
async fetch(request: Request, env: any) { | ||
return new Response( | ||
`request method111: ${request.method}, and env is ${JSON.stringify( | ||
env | ||
)} ${Date()}` | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"module": "esnext", | ||
"target": "es2020", | ||
"lib": ["es2020"], | ||
"strict": true, | ||
"alwaysStrict": true, | ||
"preserveConstEnums": true, | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"types": ["@cloudflare/workers-types", "@types/jest"] | ||
}, | ||
"include": ["src"], | ||
"exclude": ["node_modules", "dist", "test"], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.app.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name = "edge-tunnel-vless" # todo | ||
main = "./src/main.ts" | ||
compatibility_date = "2022-05-03" | ||
workers_dev = true # should be deployed to *.workers.dev | ||
|
||
[vars] | ||
TEST_VAR = "example_dev_token" | ||
|
||
[env.default] | ||
name = "edge-tunnel-vless" | ||
workers_dev = true # should be deployed to *.workers.dev | ||
|
||
[env.default.vars] | ||
TEST_VAR = "TEST_VAR_DEFAULT" | ||
|
||
[env.custom] | ||
name = "edge-tunnel-vless" | ||
routes = [{ pattern = "$CUSTOM_DOMAIN", custom_domain = true }] | ||
|
||
[env.custom.vars] | ||
TEST_VAR = "TEST_VAR_CUSTOM" |
Oops, something went wrong.