keymap #89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: keymap | |
on: | |
push: | |
paths: | |
- '.github/workflows/keymap.*' | |
pull_request: | |
paths: | |
- '.github/workflows/keymap.*' | |
workflow_run: | |
workflows: ["zmk-build"] | |
types: | |
- completed | |
# workflow_dispatch: | |
jobs: | |
draw-keymaps: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # allow workflow to commit to the repo | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
ref: ${{ github.head_ref }} | |
# - uses: pkgxdev/setup@v1 | |
# with: | |
# +: python | |
# pipx | |
- run: | | |
python3 -m pipx install keymap-drawer | |
.github/workflows/keymap.sh | |
- 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 | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
with: | |
file_pattern: '.images/revxlp_*.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: Install svg2pdf-cli from crates.io | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: svg2pdf-cli | |
# version: '^0.11.0' # You can specify any semver range | |
- name: Run svg2pdf | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
for i in .images/revxlp_*.svg; do | |
svg2pdf "${i}" "${i/%svg/pdf}" | |
done | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
with: | |
files: ".images/revxlp_*.pdf" |