Skip to content

keymap

keymap #8

Workflow file for this run

name: keymap
on:
# Needs push so it runs for tags to generate a release
push:
tags:
- "v*.*.*"
workflow_run:
workflows: ["ZMK"]
types:
- completed
workflow_dispatch:
jobs:
draw-keymaps:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
ref: ${{ github.head_ref }}
- run: |
python3 -m pipx install git+https://github.com/caksoylar/keymap-drawer.git
.github/workflows/keymap.sh
- uses: actions/upload-artifact@v4
with:
name: keymaps
path: ".images/keymap_*.svg"
include-hidden-files: true
push-or-release:
runs-on: ubuntu-latest
needs: draw-keymaps
permissions:
contents: write # allow workflow to commit to the repository
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
ref: ${{ github.head_ref }}
- uses: actions/download-artifact@v4
with:
name: keymaps
# run-id: ${{ github.event.workflow_run.id }}
path: ".images"
- name: get commit info
id: last_commit
run: |
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
echo "author=$(git log -1 --pretty='%an <%ae>')" >> $GITHUB_OUTPUT
git config pull.rebase true
git pull || true
- uses: stefanzweifel/git-auto-commit-action@v5
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
file_pattern: ".images/*.svg"
# So the previous commit is amended instead of creating a new one when desired
# See:
# - https://github.com/stefanzweifel/git-auto-commit-action#using---amend-and---no-edit-as-commit-options
# - https://github.com/stefanzweifel/git-auto-commit-action/issues/159#issuecomment-845347950
# - https://github.com/actions/checkout
commit_author: ${{ steps.last_commit.outputs.author }}
commit_message: "${{ steps.last_commit.outputs.message }}"
commit_options: "--amend --no-edit"
push_options: "--force-with-lease"
skip_fetch: true
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
files: ".images/keymap_*.svg"