From 4245444e55400e917cb895fb82a5de54ea38c1b6 Mon Sep 17 00:00:00 2001 From: David Houweling Date: Tue, 5 Nov 2024 20:56:23 +1100 Subject: [PATCH] fix deploy environment --- .github/workflows/build.yml | 2 +- .github/workflows/deploy.yml | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 895d300..4faecc7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,5 +37,5 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: guilt-spark-build + name: guilt-spark-build-${{ github.head_ref || github.ref_name }} path: ./dist diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dd4db12..f661871 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,10 +9,14 @@ on: jobs: deploy: runs-on: ubuntu-latest - environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} + environment: ${{ github.event.workflow_run.head_branch == 'main' && 'production' || 'staging' }} if: ${{ github.event.workflow_run.conclusion == 'success' }} - timeout-minutes: 60 + timeout-minutes: 10 steps: + - name: Debug + run: ${{ tojson(github.event) }} + shell: cat {0} + - name: Check out Git repository uses: actions/checkout@v4 @@ -28,17 +32,16 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: guilt-spark-build + name: guilt-spark-build-${{ github.event.workflow_run.head_branch }} run-id: ${{ github.event.workflow_run.id }} github-token: ${{ secrets.GITHUB_TOKEN }} - name: Build & Deploy Worker uses: cloudflare/wrangler-action@v3 with: - wranglerVersion: 3.84.1 apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} + environment: ${{ github.event.workflow_run.head_branch == 'main' && 'production' || 'staging' }} vars: | DISCORD_APP_ID DISCORD_PUBLIC_KEY