From 9714d18d0131dff2807706ec78ed97f03d8c21f7 Mon Sep 17 00:00:00 2001
From: Chris Coley <chris@codingallnight.com>
Date: Sun, 23 Apr 2023 01:56:19 -0700
Subject: [PATCH] Use publicly browsable artifacts instead of pages

---
 .gitlab-ci.yml | 13 +++++++++----
 src/index.html |  5 ++++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e8a4e07..95a58e2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,13 +4,18 @@ workflow:
   rules:
     - if: $CI_COMMIT_BRANCH
 
-pages:
+deploy-docs:
   stage: deploy
   tags:
     - docker
   script:
-    - mkdir -p public/$CI_COMMIT_BRANCH
-    - cp -r src/* public/$CI_COMMIT_BRANCH
+    - mkdir -p public
+    - cp -r src/* public/
+    - sed -i "s/%%BRANCH%%/$CI_BRANCH_NAME/g" public/index.html
+    - printenv
   artifacts:
     paths:
-    - public/$CI_COMMIT_BRANCH
+      - public/
+  environment:
+    name: $CI_COMMIT_BRANCH
+    url: "https://$CI_PAGES_URL/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/index.html"
diff --git a/src/index.html b/src/index.html
index 1f9332b..ac6769c 100644
--- a/src/index.html
+++ b/src/index.html
@@ -13,11 +13,14 @@
       <a href="https://gitlab.com/pages/">Other Examples</a>
     </div>
 
-    <h1>Hello World! Dev Branch</h1>
+    <h1>Hello World!</h1>
 
     <p>
       This is a simple plain-HTML website on GitLab Pages, without any fancy static site generator.
     </p>
+    <p>
+      It was built on the %%BRANCH%% branch
+    </p>
   </body>
 </html>
 
-- 
GitLab