From 888d94ccc397d36850da1b649f9965e60c38a70e 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 | 6 +++++- .github/workflows/deploy.yml | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 895d300..85f7491 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,10 @@ jobs: runs-on: ubuntu-latest steps: + - name: Debug + run: ${{ tojson(github.event) }} + shell: cat {0} + - name: Check out Git repository uses: actions/checkout@v4 @@ -37,5 +41,5 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: guilt-spark-build + name: guilt-spark-build-${{ github.sha }} path: ./dist diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dd4db12..38fa896 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,12 +9,18 @@ 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 + with: + ref: ${{ github.event.workflow_run.head_branch }} - name: Set up Node.js uses: actions/setup-node@v4 @@ -25,20 +31,12 @@ jobs: - name: Install Node.js dependencies run: npm ci - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: guilt-spark-build - 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 @@ -52,6 +50,7 @@ jobs: DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} XBOX_USERNAME: ${{ vars.XBOX_USERNAME }} XBOX_PASSWORD: ${{ secrets.XBOX_PASSWORD }} + deploy-cancel: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'failure' }}