From e7e63f9022f8da2489e4121a78bd5aaa22c8c3fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zweih=C3=A4nder?= <zweidev@zweihander.me>
Date: Thu, 12 Sep 2024 15:10:50 -0400
Subject: [PATCH] ci(test): merge files

---
 .github/workflows/publish.yml | 29 -----------------------------
 .github/workflows/test.yml    | 18 +++++++++++++++++-
 2 files changed, 17 insertions(+), 30 deletions(-)
 delete mode 100644 .github/workflows/publish.yml

diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
deleted file mode 100644
index a46a60b..0000000
--- a/.github/workflows/publish.yml
+++ /dev/null
@@ -1,29 +0,0 @@
----
-name: Push from master to cloudflare when all green
-'on':
-  push:
-    branches:
-      - master
-jobs:
-  deploy:
-    runs-on: ubuntu-20.04
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
-          fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
-
-      - name: Wait for tests to succeed
-        uses: lewagon/wait-on-check-action@v1.3.1
-        with:
-          ref: master
-          check-name: cypress-run
-          repo-token: ${{ secrets.REPO_GITHUB_TOKEN }}
-          wait-interval: 30
-
-      - name: Push changes
-        uses: ad-m/github-push-action@master
-        with:
-          github_token: ${{ secrets.REPO_GITHUB_TOKEN }}
-          branch: cloudflare
-          force: true
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 634a4f9..78dca4c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,5 +1,5 @@
 ---
-name: Run E2E tests on new code in master
+name: Run E2E tests on new code in master, push if green
 'on':
   push:
     branches:
@@ -43,3 +43,19 @@ jobs:
             /home/runner/work/forgingmodernity.com/forgingmodernity.com/cypress/screenshots/*
             /home/runner/work/forgingmodernity.com/forgingmodernity.com/cypress/videos/*
           retention-days: 14
+
+  deploy:
+    needs: cypress-run
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
+          fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
+
+      - name: Push changes
+        uses: ad-m/github-push-action@master
+        with:
+          github_token: ${{ secrets.REPO_GITHUB_TOKEN }}
+          branch: cloudflare
+          force: true