This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-19
Channels
- # announcements (3)
- # asami (3)
- # babashka (39)
- # beginners (65)
- # calva (13)
- # cider (4)
- # clj-kondo (69)
- # cljdoc (19)
- # cljs-dev (2)
- # clojure (90)
- # clojure-dev (10)
- # clojure-europe (61)
- # clojure-france (15)
- # clojure-nl (8)
- # clojure-uk (2)
- # clojurescript (28)
- # conjure (2)
- # core-logic (4)
- # cursive (8)
- # datalevin (5)
- # datascript (7)
- # datomic (14)
- # depstar (4)
- # events (1)
- # graphql (7)
- # holy-lambda (5)
- # jobs (5)
- # kaocha (1)
- # malli (14)
- # membrane-term (13)
- # missionary (13)
- # nextjournal (6)
- # off-topic (1)
- # polylith (15)
- # portal (10)
- # re-frame (35)
- # reitit (1)
- # remote-jobs (3)
- # schema (3)
- # sci (121)
- # spacemacs (6)
- # tools-build (8)
- # tools-deps (74)
- # xtdb (7)
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.
@U088NU894 I'm using this setup for several projects: https://github.com/babashka/scittle/blob/main/doc/dev.md
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 install.sh
sudo bash install.sh
rm install.sh
That tip combined with a couple of things I tried earlier today worked for me:
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:
Nice. You can also use https://github.com/turtlequeue/setup-babashka for setting up bb in those
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:
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!
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: https://github.com/pink-gorilla/gorilla-guix-chan
https://github.com/pink-gorilla/gorilla-guix-chan/blob/master/gorilla/packages/babashka.scm
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.
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.
I found a way to run carve
with babashka:
https://github.com/borkdude/carve/blob/master/carve.clj
Question: does the babashak shell command have a parameter to set certain environment variables?
@hoertlehner yes: :env
and :extra-env
https://twitter.com/borkdude/status/1461264693734088704
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`.
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))