From 322d16c192719ddaa086a8c01efe7d1cd3508a64 Mon Sep 17 00:00:00 2001 From: uoosef Date: Fri, 1 Sep 2023 20:11:16 +0330 Subject: [PATCH] add auto deployment --- .github/workflows/deploy.yaml | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b520946..58f0981 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,17 +1,34 @@ name: Deploy Worker on: push: - pull_request: - repository_dispatch: + tags: + - '*' jobs: deploy: runs-on: ubuntu-latest timeout-minutes: 60 - needs: test steps: - - uses: actions/checkout@v2 - - name: Build & Deploy Worker + - name: Checkout + uses: actions/checkout@v3.3.0 + with: + ref: ${{ env.GIT_REF }} + fetch-depth: 0 + + # npm (and node16) are installed by wrangler-action in a pre-job setup + - name: Get dependencies + run: npm i + + - name: 📚 Wrangler publish + # github.com/cloudflare/wrangler-action uses: cloudflare/wrangler-action@2.0.0 with: apiToken: ${{ secrets.CF_API_TOKEN }} - accountId: ${{ secrets.CF_ACCOUNT_ID }} + # input overrides env-defaults, regardless + environment: ${{ env.WORKERS_ENV }} + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} + GIT_COMMIT_ID: ${{ env.GIT_REF }} + + - name: Notice + run: | + echo "::notice::Deployed to ${WORKERS_ENV} / ${GIT_REF} @ ${COMMIT_SHA}"