From f6cba8fa9c2109080f94a9879f249f297b122512 Mon Sep 17 00:00:00 2001 From: David Houweling Date: Tue, 5 Nov 2024 13:56:22 +1100 Subject: [PATCH] try and resolve deployment differentiation --- .github/workflows/deploy.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dd4db12..1855133 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,15 +1,21 @@ name: Deploy on: - workflow_run: - workflows: [Build] - types: - - completed + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + +env: + ENVIRONMENT: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'production' || github.event_name == 'pull_request' && 'staging' || 'manual' }} jobs: deploy: runs-on: ubuntu-latest - environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} + environment: ${{ env.ENVIRONMENT }} if: ${{ github.event.workflow_run.conclusion == 'success' }} timeout-minutes: 60 steps: @@ -38,7 +44,7 @@ jobs: wranglerVersion: 3.84.1 apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} + environment: ${{ env.ENVIRONMENT }} vars: | DISCORD_APP_ID DISCORD_PUBLIC_KEY