Skip to content

Commit

Permalink
Merge pull request #3 from petejohanson/ci/add-version-automation
Browse files Browse the repository at this point in the history
Ci/add version automation
  • Loading branch information
petejohanson authored Nov 7, 2024
2 parents 99b8506 + 2e4e7e9 commit 611034d
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 55 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.ZMK_RELEASE_PLEASE_TOKEN }}
release-type: simple
- name: tag major, minor, and patch versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git remote add gh-token "https://x-access-token:${{ secrets.ZMK_RELEASE_PLEASE_TOKEN }}@github.com/${{ github.repository }}.git"
git tag -d v${{ steps.release.outputs.major }} || true
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}"
git push --force gh-token v${{ steps.release.outputs.major }}
git push --force gh-token v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}
git push --force gh-token v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
8 changes: 8 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extra-files": [
{
"type": "generic",
"path": "app/VERSION"
}
]
}
13 changes: 13 additions & 0 deletions app/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# x-release-please-start-major
VERSION_MAJOR = 0
# x-release-please-end

# x-release-please-start-minor
VERSION_MINOR = 0
# x-release-please-end

# x-release-please-start-patch
PATCHLEVEL = 1
# x-release-please-end

VERSION_TWEAK = 0
78 changes: 23 additions & 55 deletions docs/docs/development/hardware-integration/physical-layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ A key description has the shape `<&key_physical_attrs w h x y r rx ry>` with the
| Rotation X | int | Rotation origin X position | [centi-](https://en.wikipedia.org/wiki/Centi-)"keyunit" |
| Rotation Y | int | Rotation origin Y position | [centi-](https://en.wikipedia.org/wiki/Centi-)"keyunit" |

:::tip
You can specify negative values in devicetree using parentheses around it, e.g. `(-3000)` for a 30 degree counterclockwise rotation.

:::tip

We recommend the use of [this tool](https://zmk-physical-layout-converter.streamlit.app/) for writing a physical layout or converting one from a QMK JSON definition. If your keyboard already has a physical layout defined for the use with KLE, we recommend using [this other tool](https://nickcoutsos.github.io/keymap-layout-tools/) first to convert your existing layout into QMK JSON.

:::

### Physical Layout with Keys Example
Expand Down Expand Up @@ -175,6 +179,12 @@ If necessary, you can also define multiple kscan instances.

When switching between layouts using [ZMK Studio](../../features/studio.md), an attempt is made to automatically infer bindings for the keys in the new layout from the old layout. Keys with the same physical key properties are given the same binding. This approach has some limitations, so for more accurate transference of bindings a position map is used.

:::warning

Keys whose positions can neither be inferred from the default layout nor have bindings in the position map cannot be assigned to.

:::

A position map looks something like this:

```dts
Expand Down Expand Up @@ -203,6 +213,12 @@ The position map should be marked as `complete` if all desired binding transfers

See also the [configuration section on position maps](../../config/layout.md#physical-layout-position-map).

:::tip

We recommend the use of [this tool](https://zmk-layout-helper.netlify.app/), distinct from the previous two mentioned, for the purposes of writing a position map.

:::

#### Writing a position map

Start by creating the parent node defining the position map:
Expand Down Expand Up @@ -295,7 +311,7 @@ If the left side with more keys was used as the reference layout, then the overa

```dts
/ {
keypad_lossless_position_map {
keypad_position_map1 {
compatible = "zmk,physical-layout-position-map";
complete;
Expand Down Expand Up @@ -328,7 +344,7 @@ If the right side with fewer keys were used as a reference instead, then the ove

```dts
/ {
keypad_lossy_position_map {
keypad_position_map2 {
compatible = "zmk,physical-layout-position-map";
complete;
Expand All @@ -355,7 +371,7 @@ If the right side with fewer keys were used as a reference instead, then the ove
};
```

The above example is "lossy" because (unlike the previous "lossless" example) if a user switches from the macropad layout to the numpad layout _and then_ switches from the numpad layout back to the macropad layout, the assignments to the keys present but not listed in the macropad's map are lost.
There is functionally no difference between the two approaches, but the first approach is recommended.

#### Example non-`complete` position map

Expand All @@ -365,7 +381,7 @@ A non-`complete` position map can be used to assign mappings to only these parti

```dts
/ {
keypad_lossy_position_map {
keypad_position_map3 {
compatible = "zmk,physical-layout-position-map";
macropad_map: macropad {
Expand All @@ -381,31 +397,11 @@ A non-`complete` position map can be used to assign mappings to only these parti
};
```

This is noticably simpler to write, and can be a useful way of saving flash space for memory-constrained devices. The above is a "lossy" mapping, though. While "lossless" non-`complete` mappings are possible, they can be counter-intuitive enough that it may be easier to write the full position map instead.

For completeness, the equivalent "lossless" non-`complete` position map is shown below:

```dts
/ {
keypad_lossy_position_map {
compatible = "zmk,physical-layout-position-map";
macropad_map: macropad {
physical-layout = <&macropad_layout>;
positions = <7 11 15 19 16 17>;
};
numpad_map: numpad {
physical-layout = <&numpad_layout>;
positions = <7 19 14 18 15 17>;
};
};
};
```
This is noticably simpler to write, and can be a useful way of saving flash space for memory-constrained devices.

#### Additional example: corne

The following is an example of a "lossless" position map which maps the 5-column and 6-column Corne keymap layouts. The 6 column layout is the reference layout.
The following is an example of a position map which maps the 5-column and 6-column Corne keymap layouts. The 6 column layout is the reference layout.

```dts
foostan_corne_lossless_position_map {
Expand All @@ -432,31 +428,3 @@ The following is an example of a "lossless" position map which maps the 5-column
};
};
```

Meanwhile, the "lossy" version of the same position map with the 5 column version as reference looks like this:

```dts
foostan_corne_lossy_position_map {
compatible = "zmk,physical-layout-position-map";
complete;
twelve_map: twelve {
physical-layout = <&foostan_corne_6col_layout>;
positions
= < 1 2 3 4 5 6 7 8 9 10>
, <13 14 15 16 17 18 19 20 21 22>
, <25 26 27 28 29 30 31 32 33 34>
, < 36 37 38 39 40 41 >;
};
ten_map: ten {
physical-layout = <&foostan_corne_5col_layout>;
positions
= < 0 1 2 3 4 5 6 7 8 9>
, <10 11 12 13 14 15 16 17 18 19>
, <20 21 22 23 24 25 26 27 28 29>
, < 30 31 32 33 34 35 >;
};
};
```

0 comments on commit 611034d

Please sign in to comment.