Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryogen Blog template with staging and Practicalli theme #1

Open
practicalli-johnny opened this issue Apr 10, 2023 · 0 comments
Open
Assignees
Labels

Comments

@practicalli-johnny
Copy link
Contributor

practicalli-johnny commented Apr 10, 2023

Create a Cryogen template to create a new blog project that includes

  • publishing pull requests to a staging blog
    • modified src.cryogen.core/-main to take a config file via the command line
    • GitHub workflow to publish to a separate staging repository
  • include practicalli theme
  • option to select the default theme ??

Cryogen includes a deps-new template that simply copies from the Leiningen template

Code modifications

Allow a configuration file to be passed to the -main function, which is used to build and publish the Cryogen blog

TODO: refactor the code so that the zero argument branch calls the config-file branch, e.g.

(defn -main
  "Start Cryogen with optional configuration file"
  ([]
   (-main "content/config.edn") ;; TODO: test this approach works and path to config file is correct
   ;; (load-plugins)
   ;; (compile-assets-timed )
   ;; (System/exit 0))
  ([config-file]
   (load-plugins)

   ;; Would edn reader be better than read-string?
   (compile-assets-timed (read-string (slurp config-file)))
   (System/exit 0)))

Publish Staging Website GitHub workflow

---
name: Publish Blog Staging

on: [pull_request]
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Prepare java
        uses: actions/[email protected]
        with:
          distribution: 'temurin'
          java-version: '17'

      - name: 'Cache Clojure Dependencies'
        uses: actions/cache@v3
        with:
          path: |
            ~/.m2/repository
            ~/.gitlibs
          key: cache-clojure-deps-${{ hashFiles('**/deps.edn') }}
          restore-keys: cache-clojure-deps-

      - name: Install clojure tools
        uses: DeLaGuardo/[email protected]
        with:
          cli: 1.11.1.1165

      - name: Build Blog site
        run: clojure -M:build content/config-staging.edn

      - name: Publish to GitHub Pages
        # Publish to a separate repository as GitHub pages can only be served from one branch
        # The GitHub repository for staging the website must be created before running this workflow
        # Requires developer token as deploying across repositories
        uses: JamesIves/[email protected]
        with:
          repository-name: practicalli/blog-staging
          token: ${{ secrets.CRYOGEN_PUBLISH_TOKEN }}
          branch: gh-pages # The branch the action should deploy to.
          folder: public/blog-staging # The folder the action should deploy.
          commit-message: ${{ github.event.head_commit.message }}
          single-commit: yes

Related: practicalli/clojure#404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

No branches or pull requests

1 participant