Skip to content

Commit

Permalink
Refactor deploy workflow to use cloudflare/wrangler-action@v3 and seb…
Browse files Browse the repository at this point in the history
…asptsch/toml-edit-action

Update code formatting settings
Refactor test workflow to use a more descriptive job name
  • Loading branch information
jqshuv committed Oct 15, 2024
1 parent c1e1280 commit 647f79b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,20 @@ jobs:
with:
node-version: 20.x
cache: 'pnpm'
- name: 💽 Setup Enviroment 1/3
- name: 💽 Setup Enviroment
run: cp wrangler.example.toml wrangler.toml
- name: 💽 Setup Enviroment 2/3
uses: sebasptsch/toml-edit-action@v1.3.0
with:
path: wrangler.toml
key: kv_namespaces[0].id
value: ${{ secrets.KV_NAMESPACE_ID }}
- name: 💽 Setup Enviroment 3/3
uses: sebasptsch/toml-edit-action@v1.3.0
with:
path: wrangler.toml
key: vars.AUTH_SECRET
value: ${{ secrets.AUTH_SECRET }}
- name: 🌑 Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
preCommands: |
echo "[vars]" >> wrangler.toml
echo "AUTH_SECRET = \"${AUTH_SECRET}\" " >> wrangler.toml
echo "[[kv_namespaces]]" >> wrangler.toml
echo "binding = \"SHORT_URLS\"" >> wrangler.toml
echo "id = \"${KV_NAMESPACE_ID}\"" >> wrangler.toml
environment: production
env:
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
KV_NAMESPACE_ID: ${{ secrets.KV_NAMESPACE_ID }}

12 changes: 7 additions & 5 deletions wrangler.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ compatibility_flags = ["nodejs_compat"]
[observability]
enabled = true

[vars]
AUTH_SECRET = "production_value"
# Copy file to wrangler.toml and uncomment the following block if you dont use github actions

[[kv_namespaces]]
binding = "SHORT_URLS"
id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# [vars]
# AUTH_SECRET = "production_value"

# [[kv_namespaces]]
# binding = "SHORT_URLS"
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

0 comments on commit 647f79b

Please sign in to comment.