Fork me on GitHub
#babashka
<
2021-11-23
>
awb9907:11:42

Is there a babashka script / task that updates github pages in a build? I found github actions that update github pages based on a directory in the git repo. But this means that all kind of files have to be in source code revision management. Adn I dont want that. Babashka should just upload a folder that gets calculated in the ci pipeline to github pages.

borkdude08:11:00

@hoertlehner Here is an example of an approach that is used with babashka: https://github.com/liquidz/liquidz/blob/master/build.clj

borkdude08:11:26

and oh btw, this is also an example of how to use the GraphQL API with bb /cc @U0HFRSY0M

awb9908:11:44

Amazing 😍 😍 😍 😍

awb9908:11:51

Thank you Sir!

awb9908:11:14

Just read the script. I guess it is used to build the readme file.

awb9908:11:41

For me this approach will not work in the long run.

awb9908:11:07

I have hundreds of files that get created in the JavaScript build.

awb9908:11:32

I made a little test to see if I can Script it with babashka

borkdude08:11:39

right. what you can do is make a gh-pages orphan branch

borkdude08:11:29

it does need to be under version control but it can be a separate branch so you don't pollute your main branch with this stuff.

awb9908:11:00

But I need to run this in the CI pipeline .. which will work .. but If I dont check the output into the repo, then I need an api to send the files to GitHub

borkdude08:11:28

you do need to check the output in the repo, that is how github pages works I think

borkdude08:11:12

but who cares, if this is a separate branch

borkdude08:11:34

why do you have hundreds of files btw? aren't you using advanced compilation?

awb9908:11:27

I am compiling clojure Notebooks

awb9908:11:38

And I have 40 ui renderers

awb9908:11:50

Each one goes into a separate Module

awb9908:11:04

Because otherwise the bundle gets too big

awb9908:11:33

After 2 years working on this Project I am finally headed towards something that I can release to the public

borkdude08:11:58

I recommend the orphan branch approach

awb9908:11:21

Thanks a lot

awb9908:11:26

I will try that

mmz08:11:27

I'm quite happy with this approach:

name: Run Script

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  workflow_dispatch:

jobs:
  build:
    name: Run script
    runs-on: [self-hosted, research]
    container: bitnami/git:2.34.0

    steps:
      - name: Checkout
        uses: actions/[email protected]

      - name: install babashka
        run: |
          curl -s  -o install.sh
          bash install.sh --version 0.6.5

      - name: Generate page(s)
        run: bb your-html-creating-babashka-script-here.clj

      - name: Install rsync # needed for the publish action 
        run: |
          apt-get update
          apt-get install -y rsync

      - name: Publish
        uses: JamesIves/[email protected]
        with:
          branch: gh-pages
          folder: publish
          git-config-name: Github Actions
          git-config-email: 

mmz08:11:59

no git magic and only generated stuff is on the gh-pages branch

mmz08:11:54

(so locally I just check my publish folder in the main branch and never bother to look at the gh-pages branch; that is taken care of by the action)

borkdude09:11:35

elegant approach!

borkdude09:11:49

@U088NU894 you run github actions self-hosted?

mmz09:11:37

yes .. for work we have self hosted runners because of ip, security, partial access to our VPN etc

xlfe10:11:36

If anyone's interested, I've started working on a babashka home automation system https://github.com/xlfe/radiale - the idea being clojure is a better language to drive a home automation backend than Python! but python has all the interop with IOT things. I've currently got MQTT-client, mdns, esphome and deconz working. My first attempt (https://github.com/xlfe/cljhome) was to do it all with a graal image, but I realised I didn't need to reinvent everything that's in python, just utilise babashka's pod model..

partywombat 3
🎉 2
borkdude10:11:48

Happy to see the pod model used in this way! Awesome project :)

😁 1
borkdude17:11:58

tools namespace lite: discover namespaces with pure clojure. https://gist.github.com/borkdude/fb42d1997f6e79c445cf1ae213ac9e9f works with babashka on master.

🤓 1