Fork me on GitHub

I'm looking for a (preferably) simple example github action where (1) babashka generates a html page in the action with code from the master branch and (2) that generated html page is published to the gh-pages branch. I have it working locally, but apparently I'm missing some docker or github action magic.


So I'm using a so called orphan branch


I'm not exactly sure at which step you are stuck. Perhaps you can reduce the problem statement to a smaller scope.


Thanks, I'll try: On my machine (where babashka and git are installed) I can run my html-generating script on the master branch which will publish the generated html to a publish folder. Pushing to gh-pages from my local machine works with worktree (and with git subtree and by simply checking out the gh-branch merging with master and pointing the gh-pages root folder to the publish directory). So far so good. But I can't seem to find a proper (combination of) docker container(s) that have babashka installed and the correct git stuff installed or the correct package manager to properly install babashka . Feel like I'm yak-shaving, hence my question: can someone show me a github action file that already does this stuff so I can see where my assumptions are broken.


You can use the installer script in any docker container:

curl -s  -o
sudo bash


That tip combined with a couple of things I tried earlier today worked for me:

name: Run Script

      - master
      - master

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

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

      - name: install babashka
        run: |
          curl -s  -o
          bash --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]
          branch: gh-pages
          folder: publish
          git-config-name: Github Actions


Thank you ๐Ÿ™:skin-tone-3:


Is this Github actions?


Nice. You can also use for setting up bb in those


Of course you don't have to


There always seems to be something missing ... git, a specific add-on git command, a package manager, curl, etc. This setup works. ๐Ÿ˜… ๐Ÿคž:skin-tone-3:

๐Ÿ‘ 1

That thing isn't a specific image, it's just an action which installs babashka


Just want to provide some feedback on babashka tasks: Its the best tool I found in a long time. Prior to that I only remember rclone. With rclone, I have a simple command line interface which allows me to move files between cloud providers. So what is so cool about babashka tasks: well, I have A LOT of bash files. I have a repo for my linux install tasks. In there are 30 bash scripts, for each distro I use (manjaro/debian/redhat/guix). So 120 scripts. Now I have no idea which scripts I have. Many times I created a new bash file just to install an app with a specific configuration. This is because bash scripting sucks. With babashka tasks, I have a task list. So I dont need to do ls to find my bash scripts. Since babashka is clojure, I can easily do some checks on the parameters that I pass to bb tasks, to see if this is valid. If I dont have a custom config for a app, I cannot install that profile. Babashka tasks is a tool that gives me 10x benefit. I can combine multiple things, that otherwise with bash I could not. I could of course, but my bash scripts would suck, due to obscure bash syntax. It is absolutely amazing how many clojure libraries work in babashka. So I really dont need two different apis/interfaces. And of course the thing to run tasks in parallel or sequentially. I wonder if there are some cli tools that generate nice menus. It would be really intersting to say auto generate a cli dialog to pick an option. I am sure this tools exist, and that they can be integrated with babashka. A sort of parameter picker for bb tasks. Anyhow. Its an amazinig tool. Thank you so much!

โค๏ธ 1
๐Ÿš€ 2

In case someone uses GUIX. GUIX makes sense, as it is an operating system that can be configured with guile, a scheme dialect. There is no package for babashka , so I made one:


This is the package for babashka.


To my shame, I am doing a binary install only. I would like to do a full source code build of babashka on another day. ๐Ÿ™‚ When that happens, I guess guix will include babashka to their main repo list.


There are also packages on nix for babashka, perhaps it's a similar strategy


I am sure it is.


But for guix, they define g-expressions. This is a concept I dont yet understand. It is like a macro, but on a package manager level. And there is no way to test this macros. So I - at the moment - am not able to do that.


The binary file install was all I managed to do.


And this took me a week ๐Ÿ™‚

โค๏ธ 1
๐Ÿ™Œ 1

Question: does the babashak shell command have a parameter to set certain environment variables?


so to set an environment variable only for the shell command that runs ?


:extra-env adds to the environment that already exists in bb, :env replaces it


Thanks! Sorry for asking stupid questions. I tried to find it in the bababshka book.. but could not find it...


I will add it to the book. It says this in the docs: > Other supported options are similar to those ofย `babashka.process/process`.


Is there any function that adds to a path?


Like export XXX=$XXX:blah


No, you cannot do that in a JVM, the environment is immutable


I will write it with System/getEnv


You can however launch a new bb with env vars: (shell {:extra-env {"FOO" "BAR"} "bb some-task")


(defn guix [command & args] (println "running guix " command) (apply shell "guix" command args)) (defn extra-path-env [var extra] (let [current (System/getenv var) appended (str current ":" extra)] (println "adding extra path: " appended) {:extra-env (assoc {} var appended)})) (defn guix-extra [command & args] (apply shell (extra-path-env "GUILE_LOAD_PATH" "./scm") "guix" command args))

๐Ÿ‘ 1



love it ๐Ÿ™‚