diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ae047f1..5ac7910 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -1,9 +1,14 @@
-name: Build
+name: Build and deploy
 
 on:
   push:
   pull_request:
 
+permissions:
+  contents: read
+  pages: write
+  id-token: write
+
 jobs:
   build:
     runs-on: ubuntu-latest
@@ -20,3 +25,17 @@ jobs:
         uses: actions/upload-pages-artifact@v2
         with:
           path: ./result/www
+
+  deploy:
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+
+    runs-on: ubuntu-latest
+    needs: build
+    if: github.event_name == 'push' && github.ref == 'refs/heads/master'
+
+    steps:
+      - name: Deploy to GitHub Pages
+        id: deployment
+        uses: actions/deploy-pages@v2
diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml
deleted file mode 100644
index 462db72..0000000
--- a/.github/workflows/deploy.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-# Inspired by https://github.com/actions/starter-workflows/blob/main/pages/mdbook.yml
-name: Deploy
-
-on:
-  push:
-    branches: [$default-branch]
-  workflow_dispatch:
-
-permissions:
-  contents: read
-  pages: write
-  id-token: write
-
-jobs:
-  deploy:
-    environment:
-      name: github-pages
-      url: ${{ steps.deployment.outputs.page_url }}
-    runs-on: ubuntu-latest
-    needs: build
-    steps:
-      - name: Deploy to GitHub Pages
-        id: deployment
-        uses: actions/deploy-pages@v2