-
Notifications
You must be signed in to change notification settings - Fork 62
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
Get help action to add to ZMK archive. #58
Comments
Hi, this is certainly achievable, but I am pretty sure it would require editing Copying from the reusable workflow, you could probably append an extra step to the end so that it looks like this: on: [push, pull_request, workflow_dispatch]
jobs:
build:
uses: zmkfirmware/zmk/.github/workflows/build-user-config.yml@main
draw:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive
- name: Install keymap-drawer (pypi)
run: python3 -m pip install keymap-drawer
- name: Draw keymaps
run: |
get_args() {
local keyboard=$2
eval set -- "$1"
for arg; do
local key=${arg%%:*}
local val=${arg#*:}
if [ "$key" = "$keyboard" ]; then
echo "$val"
break
fi
done
}
mkdir -p "${{ inputs.output_folder }}"
config_path="${{ inputs.config_path }}"
[ -e "$config_path" ] && config_arg=(-c "$config_path") || config_arg=()
for keymap_file in ${{ inputs.keymap_patterns }}; do
keyboard=$(basename -s .keymap "$keymap_file")
echo "INFO: drawing for $keyboard"
parse_args=$(get_args "${{ inputs.parse_args }}" "$keyboard")
echo "INFO: got extra parse args: $parse_args"
draw_args=$(get_args "${{ inputs.draw_args }}" "$keyboard")
echo "INFO: got extra draw args: $draw_args"
if [ -f "config/${keyboard}.json" ]; then
echo "INFO: found config/${keyboard}.json";
draw_args+=" -j config/${keyboard}.json"
fi
keymap "${config_arg[@]}" parse -z "$keymap_file" $parse_args >"${{ inputs.output_folder }}/$keyboard.yaml" \
&& keymap "${config_arg[@]}" draw "${{ inputs.output_folder }}/$keyboard.yaml" $draw_args >"${{ inputs.output_folder }}/$keyboard.svg" \
|| echo "ERROR: parsing or drawing failed for $keyboard!"
done
- name: Upload drawings
uses: actions/upload-artifact@v2
with:
name: ${{ inputs.archive_name }}
path: ${{ inputs.output_folder }}/* You will have to replace all Here we just called an upload-artifact step rather than a commit step in the workflow. Hopefully with the same filename as ZMK ( |
Thank you so much for the quick and thoughtful response. I tried it and it works perfectly! How hard would it be to add this to the reusable workflow? Could this be another option documented in the readme? If it would be difficult, or its not something you're interested in merging, feel free to close. And thank you. |
I think it makes sense to add an alternative reusable workflow which integrates build with draw like above, but properly parametrized with the combination of parameters from both steps. I'll take a stab at that soon and close this issue if it happens. |
Hm, I believe that you cannot add files to an already existing artifact. You probably would have to pull and extract the ZMK artifact "firmware" then pull/extract the keymap-drawer artifact (see today's PR) merge them and then upload them overwriting the ZMK's firmware artifact. It would get a new id, but keep the name then. And you would need to chain both jobs together with 'need'. That's what my tinktering with this stuff in the last 2 days got me understanding... |
I think this may have been a Github change recently. The code caksoylar was working for my, but now gives warnings about updating |
Sadly the new |
When using ZMK the workflow is that when you push it commit a github action starts that builds a zip download of the firmware. I would really love the key map image to be part of that zip archive. That way if I have multiple archives on my computer I easily tell what key map each set of firmware will use.
I don't know if this is possible, but it would be really cool if it was!
The text was updated successfully, but these errors were encountered: