Skip to content

Commit

Permalink
Update cloudflare/wrangler-action action to v3 (#54)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Léo Colombaro <[email protected]>
  • Loading branch information
renovate[bot] and LeoColomb authored Aug 8, 2023
1 parent 5c24538 commit 90c09b9
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,25 @@ jobs:
- name: Use Terraform
uses: hashicorp/setup-terraform@v2

- name: Prepare Terraform State
uses: cloudflare/wrangler-action@2.0.0
- name: Retrieve Terraform State
uses: cloudflare/wrangler-action@3.0.0
with:
command: kv:namespace list | jq -r '.[] | select( .title == "dispoflare-terraform-state" ) | .id' | awk '{print "tfstate_kv="$1}' >> $GITHUB_ENV
command: kv:namespace list > .kv_namespace_list.json
postCommands: jq -r '.[] | select( .title == "dispoflare-terraform-state" ) | .id' .kv_namespace_list.json | awk '{print "tfstate_kv="$1}' >> $GITHUB_ENV
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
preCommands: apt-get update && apt-get -y install jq
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

- name: Init Terraform
run: terraform init
working-directory: ./.terraform

- name: Download Terraform State
uses: cloudflare/wrangler-action@2.0.0
uses: cloudflare/wrangler-action@3.0.0
with:
command: kv:key get --namespace-id=${{ env.tfstate_kv }} terraform.tfstate > ./.terraform/terraform.tfstate
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
postCommands: chmod 777 ./.terraform/terraform.tfstate
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
if: ${{ env.tfstate_kv != '' }}

- name: Configure
Expand All @@ -45,22 +43,20 @@ jobs:
TF_VAR_sentry_dsn: ${{ secrets.SENTRY_DSN }}

- name: Init Terraform State
uses: cloudflare/[email protected]
uses: cloudflare/[email protected]
if: ${{ env.tfstate_kv == '' }}
with:
command: kv:namespace list | jq -r '.[] | select( .title == "dispoflare-terraform-state" ) | .id' | awk '{print "tfstate_kv="$1}' >> $GITHUB_ENV
command: kv:namespace list > .kv_namespace_list.json
postCommands: jq -r '.[] | select( .title == "dispoflare-terraform-state" ) | .id' .kv_namespace_list.json | awk '{print "tfstate_kv="$1}' >> $GITHUB_ENV
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
preCommands: apt-get update && apt-get -y install jq
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
if: ${{ env.tfstate_kv == '' }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

- name: Store Terraform State
uses: cloudflare/wrangler-action@2.0.0
uses: cloudflare/wrangler-action@3.0.0
with:
command: kv:key put --namespace-id=${{ env.tfstate_kv }} terraform.tfstate --path=./.terraform/terraform.tfstate
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

app:
runs-on: ubuntu-latest
Expand All @@ -80,7 +76,7 @@ jobs:
run: npm ci

- name: Publish to Cloudflare Workers
uses: cloudflare/wrangler-action@2.0.0
uses: cloudflare/wrangler-action@3.0.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
Expand All @@ -97,7 +93,7 @@ jobs:
run: npm run build

- name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@2.0.0
uses: cloudflare/wrangler-action@3.0.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
Expand Down

0 comments on commit 90c09b9

Please sign in to comment.