From 403fede3f51db5363fa53f01c511829cec5f0a69 Mon Sep 17 00:00:00 2001
From: Chris Coley <chris@codingallnight.com>
Date: Sun, 23 Apr 2023 01:31:50 -0700
Subject: [PATCH 1/3] Add support for branch subdirectories

---
 .gitlab-ci.yml             | 10 ++++++----
 {public => src}/index.html |  2 +-
 {public => src}/style.css  |  0
 3 files changed, 7 insertions(+), 5 deletions(-)
 rename {public => src}/index.html (94%)
 rename {public => src}/style.css (100%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 313b5c4..5c50814 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,13 +1,15 @@
 image: alpine:latest
 
+workflow:
+  rules:
+    - if: $CI_COMMIT_BRANCH
+
 pages:
   stage: deploy
   tags:
     - docker
   script:
-  - echo 'Nothing to do...'
+    - cp -r src public/$CI_COMMIT_BRANCH
   artifacts:
     paths:
-    - public
-  only:
-  - master
+    - public/CI_COMMIT_BRANCH
diff --git a/public/index.html b/src/index.html
similarity index 94%
rename from public/index.html
rename to src/index.html
index 6652c7d..1f9332b 100644
--- a/public/index.html
+++ b/src/index.html
@@ -13,7 +13,7 @@
       <a href="https://gitlab.com/pages/">Other Examples</a>
     </div>
 
-    <h1>Hello World!</h1>
+    <h1>Hello World! Dev Branch</h1>
 
     <p>
       This is a simple plain-HTML website on GitLab Pages, without any fancy static site generator.
diff --git a/public/style.css b/src/style.css
similarity index 100%
rename from public/style.css
rename to src/style.css
-- 
GitLab


From e34077c1732114071840de3d208e2881739fb346 Mon Sep 17 00:00:00 2001
From: Chris Coley <chris@codingallnight.com>
Date: Sun, 23 Apr 2023 01:33:24 -0700
Subject: [PATCH 2/3] Make sure the branch subdirectory exists

---
 .gitlab-ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5c50814..bba6a9b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,8 @@ pages:
   tags:
     - docker
   script:
+    - mkdir -p public/$CI_COMMIT_BRANCH
     - cp -r src public/$CI_COMMIT_BRANCH
   artifacts:
     paths:
-    - public/CI_COMMIT_BRANCH
+    - public/$CI_COMMIT_BRANCH
-- 
GitLab


From 9582ca672bb57a48d68a5e45a001c44f038f7397 Mon Sep 17 00:00:00 2001
From: Chris Coley <chris@codingallnight.com>
Date: Sun, 23 Apr 2023 01:34:58 -0700
Subject: [PATCH 3/3] Copy contents of src directory, not the directory itself

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bba6a9b..e8a4e07 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,7 +10,7 @@ pages:
     - docker
   script:
     - mkdir -p public/$CI_COMMIT_BRANCH
-    - cp -r src public/$CI_COMMIT_BRANCH
+    - cp -r src/* public/$CI_COMMIT_BRANCH
   artifacts:
     paths:
     - public/$CI_COMMIT_BRANCH
-- 
GitLab