diff --git a/Butane/.woodpecker.yaml b/Butane/.woodpecker.yaml new file mode 100644 index 0000000..cb52594 --- /dev/null +++ b/Butane/.woodpecker.yaml @@ -0,0 +1,24 @@ +when: + branch: main + event: [ push, pull_request ] + +steps: + - name: build + image: quay.io/coreos/butane:release + commands: + - bash ./script.sh + + - name: push + image: docker.io/alpine/git:latest + environment: + MAIL: + from_secret: mail + CODEBERG_TOKEN: + from_secret: codeberg_token + commands: + - git remote set-url origin https://$CODEBERG_TOKEN@codeberg.org/ + - git config user.email $MAIL + - git config user.name "Woodpecker CI" + - git add . + - git commit -m "CI translate Butane to Ignition files [SKIP CI]" + - git push origin main diff --git a/Butane/script.sh b/Butane/script.sh new file mode 100644 index 0000000..55f00c1 --- /dev/null +++ b/Butane/script.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# loop through all butane files in the current directory +for i in *.bu ; do + # extract filename without extension + name=${i%.bu} + + # use butane to convert the YAML file into an Ignition configuration + butane -ps ${i} -o ${name}.ign + + if [ $? -eq 0 ]; then + echo "Converted ${i} to ${name}.ign successfully" + else + echo "Error converting ${i}" + fi +done