qmk_firmware/assets/newbs_building_firmware_workflow.md.BP-lGh0Q.js

98 lines
25 KiB
JavaScript
Raw Normal View History

import { _ as _export_sfc, c as createElementBlock, I as createVNode, w as withCtx, a8 as createStaticVNode, D as resolveComponent, o as openBlock, l as createBaseVNode, a as createTextVNode } from "./chunks/framework.B9AX-CPi.js";
const __pageData = JSON.parse('{"title":"Building QMK with GitHub Userspace","description":"","frontmatter":{},"headers":[],"relativePath":"newbs_building_firmware_workflow.md","filePath":"newbs_building_firmware_workflow.md","lastUpdated":null}');
const _sfc_main = { name: "newbs_building_firmware_workflow.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="building-qmk-with-github-userspace" tabindex="-1">Building QMK with GitHub Userspace <a class="header-anchor" href="#building-qmk-with-github-userspace" aria-label="Permalink to &quot;Building QMK with GitHub Userspace&quot;"></a></h1><p>This is an intermediate QMK tutorial to setup an out-of-tree build environment with a personal GitHub repository. It avoids using a fork of the QMK firmware to store and build your keymap within its source tree. Keymap files will instead be stored in your own personal GitHub repository, in <a href="./feature_userspace">Userspace</a> format, and built with an action workflow. Unlike the <a href="./newbs">default tutorial</a>, this guide requires some familiarity with using Git.</p><div class="tip custom-block"><p class="custom-block-title">Is This Guide For Me?</p><p>This is a lean setup to avoid space-consuming local build environment in your computer. Troubleshooting compile-time errors will be slower with commit uploads to GitHub for the compiler workflow.</p></div><h2 id="prerequisites" tabindex="-1">Prerequisites <a class="header-anchor" href="#prerequisites" aria-label="Permalink to &quot;Prerequisites&quot;"></a></h2><p>The following are required to get started:</p><ul><li><a href="https://github.com/new" target="_blank" rel="noreferrer">GitHub Account</a><ul><li>A working account is required to setup and host your repository for GitHub Actions to build QMK firmware.</li></ul></li><li><a href="./newbs_learn_more_resources#text-editor-resources">Text editor</a><ul><li>Youll need a program that can edit and save plain text files. The default editor that comes with many OS&#39;s does not save plain text files, so you&#39;ll need to make sure that whatever editor you chose does.</li></ul></li><li><a href="https://github.com/qmk/qmk_toolbox" target="_blank" rel="noreferrer">Toolbox</a><ul><li>A graphical program for Windows and macOS that allows you to both program and debug your custom keyboard.</li></ul></li></ul><h2 id="environment-setup" tabindex="-1">Environment Setup <a class="header-anchor" href="#environment-setup" aria-label="Permalink to &quot;Environment Setup&quot;"></a></h2><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>If you are familiar with using <a href="https://docs.github.com/en/codespaces/the-githubdev-web-based-editor" target="_blank" rel="noreferrer">github.dev</a>, you can skip to <a href="#_2-create-github-repository">step 2</a> and commit the code files that follows directly on GitHub using the web-based VSCode editor.</p></div><h3 id="_1-install-git" tabindex="-1">1. Install Git <a class="header-anchor" href="#_1-install-git" aria-label="Permalink to &quot;1. Install Git&quot;"></a></h3><p>A working Git client is required for your local operating system to commit and push changes to GitHub.</p>', 10);
const _hoisted_11 = /* @__PURE__ */ createBaseVNode("p", null, [
/* @__PURE__ */ createTextVNode("QMK maintains a bundle of MSYS2, the CLI and all necessary dependencies including Git. Install "),
/* @__PURE__ */ createBaseVNode("a", {
href: "https://msys.qmk.fm/",
target: "_blank",
rel: "noreferrer"
}, "QMK MSYS"),
/* @__PURE__ */ createTextVNode(" with the latest release "),
/* @__PURE__ */ createBaseVNode("a", {
href: "https://github.com/qmk/qmk_distro_msys/releases/latest",
target: "_blank",
rel: "noreferrer"
}, "here"),
/* @__PURE__ */ createTextVNode(". Git will be part of the bundle.")
], -1);
const _hoisted_12 = /* @__PURE__ */ createBaseVNode("p", null, [
/* @__PURE__ */ createTextVNode("Install Homebrew following the instructions on "),
/* @__PURE__ */ createBaseVNode("a", {
href: "https://brew.sh",
target: "_blank",
rel: "noreferrer"
}, "https://brew.sh"),
/* @__PURE__ */ createTextVNode(". Git will be part of the bundle.")
], -1);
const _hoisted_13 = /* @__PURE__ */ createBaseVNode("p", null, "It's very likely that you already have Git installed. If not, use one of the following commands:", -1);
const _hoisted_14 = /* @__PURE__ */ createBaseVNode("ul", null, [
/* @__PURE__ */ createBaseVNode("li", null, [
/* @__PURE__ */ createTextVNode("Debian / Ubuntu / Devuan: "),
/* @__PURE__ */ createBaseVNode("code", null, "sudo apt install -y git")
]),
/* @__PURE__ */ createBaseVNode("li", null, [
/* @__PURE__ */ createTextVNode("Fedora / Red Hat / CentOS: "),
/* @__PURE__ */ createBaseVNode("code", null, "sudo yum -y install git")
]),
/* @__PURE__ */ createBaseVNode("li", null, [
/* @__PURE__ */ createTextVNode("Arch / Manjaro: "),
/* @__PURE__ */ createBaseVNode("code", null, "sudo pacman --needed --noconfirm -S git")
]),
/* @__PURE__ */ createBaseVNode("li", null, [
/* @__PURE__ */ createTextVNode("Void: "),
/* @__PURE__ */ createBaseVNode("code", null, "sudo xbps-install -y git")
]),
/* @__PURE__ */ createBaseVNode("li", null, [
/* @__PURE__ */ createTextVNode("Solus: "),
/* @__PURE__ */ createBaseVNode("code", null, "sudo eopkg -y install git")
]),
/* @__PURE__ */ createBaseVNode("li", null, [
/* @__PURE__ */ createTextVNode("Sabayon: "),
/* @__PURE__ */ createBaseVNode("code", null, "sudo equo install dev-vcs/git")
]),
/* @__PURE__ */ createBaseVNode("li", null, [
/* @__PURE__ */ createTextVNode("Gentoo: "),
/* @__PURE__ */ createBaseVNode("code", null, "sudo emerge dev-vcs/git")
])
], -1);
const _hoisted_15 = /* @__PURE__ */ createStaticVNode('<h3 id="_2-github-authentication" tabindex="-1">2. GitHub authentication <a class="header-anchor" href="#_2-github-authentication" aria-label="Permalink to &quot;2. GitHub authentication&quot;"></a></h3><p>If your GitHub account is not configured for <a href="https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/" target="_blank" rel="noreferrer">authenticated Git operations</a>, you will need to setup at least one of the following:</p><ul><li><a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token" target="_blank" rel="noreferrer">Personal access token</a></li><li><a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh" target="_blank" rel="noreferrer">Connecting with SSH</a></li></ul><h3 id="_3-create-a-repository" tabindex="-1">3. Create a repository <a class="header-anchor" href="#_3-create-a-repository" aria-label="Permalink to &quot;3. Create a repository&quot;"></a></h3><p>You will need a personal GitHub repository to host your QMK code. Follow <a href="https://docs.github.com/en/get-started/quickstart/create-a-repo#create-a-repository" target="_blank" rel="noreferrer">this guide</a> to create one named <code>qmk_keymap</code>. Do not proceed to commit any files just yet.</p><h2 id="initial-code-commit" tabindex="-1">Initial Code Commit <a class="header-anchor" href="#initial-code-commit" aria-label="Permalink to &quot;Initial Code Commit&quot;"></a></h2><h3 id="create-template-files" tabindex="-1">Create template files <a class="header-anchor" href="#create-template-files" aria-label="Permalink to &quot;Create template files&quot;"></a></h3><p>Run the following commands in your computer to create a folder with a few template files:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span>mkdir -p ~/qmk_keymap/.github/workflows</span></span>\n<span class="line"><span>touch ~/qmk_keymap/.github/workflows/build.yml</span></span>\n<span class="line"><span>touch ~/qmk_keymap/config.h</span></span>\n<span class="line"><span>echo &quot;SRC += source.c&quot; &gt; ~/qmk_keymap/rules.mk</span></span>\n<span class="line"><span>echo &quot;#include QMK_KEYBOARD_H&quot; &gt; ~/qmk_keymap/source.c</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>For Windows user running MSYS, those commands will create the folder <code>qmk_keymap/</code> and its content in the <code>C:\\Users\\&lt;windows_username&gt;\\qmk_keymap\\</code> path location.</p></div><h3 id="add-a-json-keymap" tabindex="-1">Add a JSON keymap <a class="header-anchor" href="#add-a-json-keymap" aria-label="Permalink to &quot;Add a JSON keymap&quot;"></a></h3><p>Visit the <a href="https://config.qmk.fm/#/" target="_blank" rel="noreferrer">QMK Configurator</a> to create a keymap file:</p><ol><li>Select your keyboard from the drop-down list (and choose a layout if required).</li><li>Use your GitHub username for the <strong>Keymap Name</strong> field.</li><li>Customise the key layout according to your preference.</li><li>Select download next to <strong>KEYMAP.JSON</strong> and save the JSON file into the <code>~/qmk_keymap/</code> folder.</li></ol><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p><strong>Important:</strong> Make sure that the GitHub username you use in step 2 is correct. If it is not, the build process will fail to locate your files in the right folder.</p></div><h3 id="add-a-github-action-workflow" tabindex="-1">Add a GitHub Action workflow <a class="header-anchor" href="#add-a-github-action-workflow" aria-label="Permalink to &quot;Add a GitHub Action workflow&quot;"></a></h3><p>Open the file <code>~/qmk_keymap/.github/workflows/build.yml</code> with your favorite <a href="./newbs_learn_more_resources#text-editor-resources">text ed
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_PluginTabsTab = resolveComponent("PluginTabsTab");
const _component_PluginTabs = resolveComponent("PluginTabs");
return openBlock(), createElementBlock("div", null, [
_hoisted_1,
createVNode(_component_PluginTabs, null, {
default: withCtx(() => [
createVNode(_component_PluginTabsTab, { label: "Windows" }, {
default: withCtx(() => [
_hoisted_11
]),
_: 1
}),
createVNode(_component_PluginTabsTab, { label: "macOS" }, {
default: withCtx(() => [
_hoisted_12
]),
_: 1
}),
createVNode(_component_PluginTabsTab, { label: "Linux/WSL" }, {
default: withCtx(() => [
_hoisted_13,
_hoisted_14
]),
_: 1
})
]),
_: 1
}),
_hoisted_15
]);
}
const newbs_building_firmware_workflow = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
newbs_building_firmware_workflow as default
};