A mirror of my website's source code.

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

I'm gonna try something different for the deploy step

steve0greatness,
created on Friday, 29 December 2023, 22:47:26 (1703890046), received on Monday, 6 May 2024, 02:55:32 (1714964132)
Author identity: Steve0Greatness <75220768+Steve0Greatness@users.noreply.github.com>

4ffbaf014ed9c5c5c26b5bc6b2fab7643cacc531

.github/workflows/deploy.yml

@@ -20,9 +20,5 @@ jobs:

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                          with:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            path: "requirements.txt"
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        # You can test your matrix by printing the current Python version
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    - name: Display Python version
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                      run: python build.py
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    - name: Deploy 🚀
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                      uses: JamesIves/github-pages-deploy-action@v4
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                      with:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        folder: build # The folder the action should deploy.
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    - name: Run Python Builder
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                      run: python build.py
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                            
                                

.gitignore

@@ -1,2 +1,2 @@

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            __pycache__
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        build/*
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        docs/*
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                            
                                

build.py

@@ -5,7 +5,7 @@ from os import mkdir as CreateDirectory, listdir as ListDirectory, unlink as Del

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            from os.path import isfile as IsFile, exists as PathExists
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            from distutils.dir_util import copy_tree as CopyDirectory
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        BUILD_DIRECTORY = "build"
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        BUILD_DIRECTORY = "docs"
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            def WipeFinalDir():
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                if not PathExists(BUILD_DIRECTORY):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -48,11 +48,16 @@ def RenderPage(PageInput: str, ContentDest: str, **kwargs):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    DestLocation.write(RenderTemplate(PageInput, **kwargs))
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            if __name__ == "__main__":
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            print("Wiping directory")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                WipeFinalDir()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            print("Creating blog holder")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                CreateDirectory(BUILD_DIRECTORY + "/blog")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            print("Rendering posts...")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                RenderPosts()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            print("Copying static directory")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                CopyDirectory("static", BUILD_DIRECTORY + "/static")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            print("Building static files")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                RenderPage("index.html", "index.html", PostList=PostList)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                RenderPage("blog-list.html", "/blog/index.html", PostList=PostList)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                RenderPage("blog-feed.rss", "/blog/feed.rss", PostList=PostList)