Build to Public Directory for GitLab Pages
I think the problem here is that I'm using a directory that cannot be changed due to .gitignore
By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.
I think the problem here is that I'm using a directory that cannot be changed due to .gitignore
steve0greatness,
created on Monday, 6 May 2024, 03:35:48 (1714966548),
received on Monday, 6 May 2024, 03:46:51 (1714967211)
Author identity: Steve0Greatness <steve0greatnessiscool@gmail.com>
bae87a3536d9ed7ba7cc1da4b5049b4e0adb9f5a
image: python:latest
before_script:
- python -m pip install -r requirements.txt
pages:
stage: deploy
script:
- python3 -m pip install -r requirements.txt
- python3 build.py gh-pages-deploy
- python build.py gl-pages-deploy
artifacts:
paths:
- build
only:
- main
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
from re import sub as RegReplace
from typing import Literal
GITHUB_BUILD_DIR = "build" # Separate because this site is built with an action that won't work if they aren't
DEPLOY_BUILD_DIR = {
"gh-pages-deploy": "build",
"gl-pages-deploy": "public"
} # Separate because this site is built with an action that won't work if they aren't
LOCAL_BUILD_DIR = "build"
IS_GH_ACTIONS = len(argv) > 1 and argv[1] == "gh-pages-deploy"
BUILD_DIRECTORY = GITHUB_BUILD_DIR if IS_GH_ACTIONS else LOCAL_BUILD_DIR
PAGES_DEPLOY = argv[1] if len(argv) > 1 else None
BUILD_DIRECTORY = DEPLOY_BUILD_DIR[PAGES_DEPLOY] if PAGES_DEPLOY is not None else LOCAL_BUILD_DIR
PAGES = {
"index.html": "index.html",
def GetBlogList():
print("Grabbing post list")
PostSlugs: tuple[tuple[Literal["blog-posts", "drafts"], str], ...] = tuple( ("blog-posts", file) for file in ListDirectory("blog-posts") )
if not IS_GH_ACTIONS and PathExists("drafts"):
if not PAGES_DEPLOY and PathExists("drafts"):
PostSlugs = PostSlugs + tuple( ("drafts", file) for file in ListDirectory("drafts") )
Posts = []
for dir, slug in PostSlugs: