Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cf worker hello world project and enable deploy via GITHUB action #78

Merged
merged 19 commits into from
Dec 17, 2022
Prev Previous commit
Next Next commit
add action
zizifn committed Dec 17, 2022
commit 3edcf40db15c1bef8ba46febe0a575a46ffb2aa8
16 changes: 9 additions & 7 deletions .github/workflows/cf-worker-deploy.yml
Original file line number Diff line number Diff line change
@@ -6,11 +6,6 @@ on:
- main
- test-cf
workflow_dispatch:
inputs:
environment:
description: 'Choose an environment to deploy to: <dev|staging|prod>'
required: true
default: 'dev'

jobs:
deploy:
@@ -19,13 +14,20 @@ jobs:
name: Deploy
steps:
- uses: actions/checkout@v2
- name: envsubst
if: ${{github.event.inputs.turn_k8s_base_app == 'ON'}}
run: |
envsubst < apps/cf-worker-vless/wrangler.toml.tp > apps/cf-worker-vless/wrangler.toml
echo cf_environment="custom" >> $GITHUB_ENV
env:
CUSTOM_DOMAIN: ${{ secrets.CUSTOM_DOMAIN }}
- name: Publish
uses: cloudflare/wrangler-action@2.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: publish --env ${{ github.event.inputs.environment || 'prod' }}
command: publish --env ${{ env.cf_environment || 'default' }}
workingDirectory: 'apps/cf-worker-vless'
environment: ${{ github.events.inputs.environment || 'prod' }}
environment: ${{ env.cf_environment || 'default' }}
secrets: |
UUID
env:
File renamed without changes.
15 changes: 15 additions & 0 deletions apps/cf-worker-vless/wrangler.toml.tp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name = "my-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 = "my-vless"
workers_dev = true # should be deployed to *.workers.dev

[env.custom]
name = "my-vless"
routes = [{ pattern = "$CUSTOM_DOMAIN", custom_domain = true }]