Skip to content

Commit

Permalink
chore: update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
7Sageer committed Oct 3, 2024
1 parent 1c1931a commit fcb9bd8
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '21'

Expand All @@ -30,14 +30,14 @@ jobs:
run: |
KV_NAMESPACE="SUBLINK_KV"
echo "Checking for KV namespace: $KV_NAMESPACE"
LIST_OUTPUT=$(wrangler kv:namespace list)
LIST_OUTPUT=$(wrangler kv namespace list)
echo "KV namespace list output: $LIST_OUTPUT"
KV_ID=$(echo "$LIST_OUTPUT" | jq -r '.[] | select(.title == "sublink-worker-'$KV_NAMESPACE'") | .id')
if [ -z "$KV_ID" ]; then
echo "KV namespace $KV_NAMESPACE does not exist. Creating..."
CREATE_OUTPUT=$(wrangler kv:namespace create "$KV_NAMESPACE")
CREATE_OUTPUT=$(wrangler kv namespace create "$KV_NAMESPACE")
echo "Create KV namespace output: $CREATE_OUTPUT"
KV_ID=$(echo "$CREATE_OUTPUT" | grep -oP 'id = "\K[^"]+')
Expand All @@ -51,12 +51,6 @@ jobs:
echo "KV namespace $KV_NAMESPACE already exists with ID: $KV_ID"
fi
echo "Final KV_ID: $KV_ID"
echo "KV_ID=$KV_ID" >> $GITHUB_ENV
- name: Display wrangler.toml before update
run: cat wrangler.toml

- name: Update wrangler.toml
run: |
# Read the entire content of wrangler.toml
Expand All @@ -74,4 +68,5 @@ jobs:
- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@2.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
apiToken: ${{ secrets.CF_API_TOKEN }}
command: deploy

0 comments on commit fcb9bd8

Please sign in to comment.