Contents
- Summary
- 0. Introduction
- 1. Basic library file structure
- 1.1 src/ - Source code directory (required)
- 1.2 examples/ - Example code directory (optional but recommended)
- 1.3 library.properties - Library metadata file (required)
- 1.4 keywords.txt - Syntax highlighting keywords (optional)
- 1.5 README.md - Documentation (see the previous tutorial)
- 1.6 LICENSE - License (see the previous tutorial)
- 1.7 extras/ - Supplementary resources directory
- 2. Packaging the library
- 3. Uploading to GitHub
- 4. Creating a Release and a Tag
- 4.1 Creating a Tag on GitHub
- 4.1.1 What is a Tag
- 4.1.2 Steps
- 4.2 Creating a release
- 4.2.1 What is a release
- 4.2.2 Steps
- 5. Submitting to the Arduino Library Manager
- 5.1Fork Arduino Library Registry
- 5.2 Editing repositories.txt
- 5.3 Submitting a Pull Request
- 5.4 Handling check results and errors
- 5.5 Verifying in Arduino
- References
Summary
Publishing a third-party Arduino library involves: building the basic library skeleton, packaging it and uploading it to GitHub, creating a Tag and a Release on GitHub, submitting it to the Arduino Library Manager, and finally verifying it in the Arduino IDE.
0. Introduction
In the previous tutorial we covered how to publish a Python/Micropython library.
So how do you publish a third-party Arduino library?
And what do you need to do so that your own library can be found through the library manager in the Arduino IDE?
This tutorial uses the Arduino version of the serial servo library as an example.
1. Basic library file structure
A typical Arduino library directory has the following key parts:
YourLibraryName/
├── src/ // Source code directory (required)
│ ├── YourLibraryName.h // Header file
│ └── YourLibraryName.cpp // Source file
├── examples/ // Example code directory (optional but recommended)
│ └── one/ // Folder for the first example
│ └── one.ino // Example 1
│ └── two/ // Folder for the second example
│ └── two.ino // Example 2
│ └── three/ // Folder for the third example
│ └── three.ino // Example 3
├── library.properties // Library metadata file (required)
├── keywords.txt // Syntax highlighting keywords (optional)
├── README.md // Documentation
└── LICENSE // License1.1 src/ - Source code directory (required)
This directory holds the core code of the library, mainly:
YourLibraryName.h: the header file, which declares your library's classes, functions and any other public interfaces.YourLibraryName.cpp: the source file, which implements the functions and classes declared in the header file.
1.2 examples/ - Example code directory (optional but recommended)
The examples folder holds example sketches that help users quickly understand and use your library.
Each example is a single .ino file, and each example goes in its own folder; the folder and the example must have the same name.
For example, suppose there are three examples named one, two and three.
Then the file structure for these three examples should be:
── examples
├── one
│ └── one.ino
├── two
│ └── two.ino
└── three
└── three.ino1.3 library.properties - Library metadata file (required)
This is the library's core file. It contains key information such as the library's name, version, author and dependencies.
The Arduino IDE needs it to recognise and load the library correctly; the Arduino IDE reads the library's details from it. A simple library.properties file looks like this:
name=MyLibrary
version=1.0.0
author=Your Name
maintainer=Your Email
sentence=MyLibrary is a simple library for controlling sensors.
paragraph=MyLibrary allows you to easily control sensors and devices.
category=Sensor
url=https://github.com/yourusername/MyLibrary
architectures=* This file uses the INI file format (note: use UTF-8 encoding). It stores information as key-value pairs, one property per line. The common fields are:
Field | Purpose | Example |
| Library name |
|
| Version number |
|
| Author |
|
| Maintainer |
|
| Supported architectures |
|
| Short description of the library |
|
| Library category |
|
| Project URL |
|
| License |
|
For the detailed specification of this file, see the official documentation.
1.4 keywords.txt - Syntax highlighting keywords (optional)
The keywords.txt file defines the library's keywords (such as functions and classes) so that the Arduino IDE can highlight them, making the code easier to read.
The syntax of this file is:
keyword[tab]KEYWORD_TOKENTYPEEach line contains one keyword and its keyword type, separated by a tab character.
The keyword type determines how the keyword is highlighted in the Arduino IDE. Common keyword types include:
KEYWORD1: usually for the library's class names.KEYWORD2: usually for the library's function names.KEYWORD3: usually for constants (such as macro definitions).LITERAL1andLITERAL2: for literal constants.
KEYWORD_TOKENTYPE | Use for | Theme property |
| datatypes |
|
| functions |
|
| structures |
|
| constants |
|
| ? |
|
1.5 README.md - Documentation (see the previous tutorial)
README.md is your library's introduction file. It usually contains:
- How to install and use the library
- A description of the library's features
- Possible configuration options
- Example code
- FAQ, etc.
1.6 LICENSE - License (see the previous tutorial)
The LICENSE file states the library's license terms, telling users their rights and restrictions when using, modifying and distributing your code.
1.7 extras/ - Supplementary resources directory
The extras folder holds documentation or other additional items related to the library. The Arduino IDE does not process anything in the extras folder, so you can put any files you need in it.
The images used in our README.md file can be placed in this folder.
2. Packaging the library
Put the files above into one folder, and make sure the folder name matches your library name.
For example, if your library is called YourLibraryName, the folder should be named YourLibraryName and contain the following files:
YourLibraryName/
├── src/ // Source code directory (required)
│ ├── YourLibraryName.h // Header file
│ └── YourLibraryName.cpp // Source file
├── examples/ // Example code directory (optional but recommended)
│ └── one/ // Folder for the first example
│ └── one.ino // Example 1
│ └── two/ // Folder for the second example
│ └── two.ino // Example 2
│ └── three/ // Folder for the third example
│ └── three.ino // Example 3
├── library.properties // Library metadata file (required)
├── keywords.txt // Syntax highlighting keywords (optional)
├── README.md // Documentation
└── LICENSE // LicenseThe name of an Arduino library's root folder must start with a basic letter (A-Z or a-z) or a digit (0-9), and may contain basic letters, digits, underscores (_), dots (.) and dashes (-). The maximum folder name length is 63 characters.
3. Uploading to GitHub
Upload your library to GitHub, or to another code hosting platform of your choice.
Once it is published, you can fill in the url.

4. Creating a Release and a Tag
4.1 Creating a Tag on GitHub
Click the Tag icon to see the Tag history for the different versions:

4.1.1 What is a Tag
A Tag is a marker in Git that points to a specific commit. It is usually used to mark important version points (such as v1.0.0):
- Types:
- Lightweight tag
Lightweight Tag: just a pointer to a commit. - Annotated tag
Annotated Tag: contains extra metadata such as the tag name, author, date and a description.
- Lightweight tag
- Purpose: marking version numbers, milestones or important states of the code.
4.1.2 Steps
First open Git Bash and create an annotated Tag (usually used for releases):
git tag -a v1.0.0 -m "First stable release"-a v1.0.0: specifies the tag name (e.g.v1.0.0).-m "First stable release": adds a description to the tag.
List all Tags:
git tagAfter creating a Tag, you must push it to GitHub before others can see it.
Push a single Tag:
git push origin v1.0.0Push all local Tags:
git push origin --tagsYou can then see the pushed Tag in the Github repository:

4.2 Creating a release
4.2.1 What is a release
A Release is a GitHub feature, built on a Tag, for publishing a specific version of software.
It can contain a Tag, a version description (such as new features and fixed bugs) and attached files (such as compiled binaries and installers). It is mainly used to formally publish a software version so users can easily download and use it.
Note: a Release must be based on a Tag. Without a Tag, you cannot create a Release.
You can think of a Release as an extension of a Tag that adds richer features (such as a version description and attached files).
In terms of use, a Tag suits marking versions or milestones during internal development, while a Release suits formal versions for users to download and use.
4.2.2 Steps
Go to your GitHub repository and, on the repository page, click the "Releases" tab at the top.
On the Releases page, click the "Draft a new release" button.

Choose a Tag:
- In the "
Tag version" field, select theTagyou created earlier (e.g.v1.0.0). If you have not created aTagyet, you can create a newTaghere. - If needed, click "
Create new tag" and give it a version number (e.g.v1.0.1).

Fill in the release information:
- Release title: give the release a title (e.g.
Version 1.0.0 - First Stable Release). - Description: in the description box, add detailed notes for this version, including new features, fixed bugs or any other changes.

Attach files (optional):
- You can upload additional binaries, build files or source code archives.
- Click "
Attach binaries by dropping them here or selecting them" and choose the files to upload.
Publish the Release:
- Choose how to publish:
Pre-release: if this version is not yet stable, you can tick the "This is a pre-release" option to mark it as a pre-release.- If the version is stable, simply click the "
Publish release" button.

5. Submitting to the Arduino Library Manager
5.1Fork Arduino Library Registry
Go to the Arduino library registry page
Open the Arduino Library Registry GitHub page.
Fork the repository
On the page you will see a "Create a new fork" button. Click it, and GitHub will start creating a copy of the repository that you can modify.
Wait for the Fork to finish
On the "Forking arduino/library-registry" page, GitHub shows a progress bar while the Fork is in progress. When the Fork finishes, GitHub automatically redirects you to your own repository's home page:
https://github.com/leezisheng/library-registry
5.2 Editing repositories.txt
Open the repositories.txt file
On your Fork repository's home page, find the repositories.txt file. This file lists the repository URLs of all libraries submitted to the Library Manager. Click the file name to open its contents page.

Edit the repositories.txt file
On the repositories.txt file page, click the pencil icon in the top right ("Edit this file") to enter edit mode.

Add your library's URL
In the editor, add your library's GitHub repository URL to the list. You can add the URL anywhere in the list. An example URL format:
https://github.com/yourusername/your-library
Make sure this URL is the home page link of your library's GitHub repository.
Commit the change
When you have finished editing, click the Commit changes... button at the top of the page. A commit dialog opens where you can enter a description for your commit. After entering the description, click Commit changes to complete the commit.
5.3 Submitting a Pull Request
Go back to your Fork repository's home page
After committing the change, you return to the repositories.txt file page. You will now see a notice that you have made changes on this branch: "This branch is 1 commit ahead of arduino:main".

Open a Pull Request
Click the Contribute button at the top of the page, then choose Open pull request. This opens the page for creating a Pull Request.

Fill in the Pull Request information
On the Pull Request page, enter a suitable title and description explaining the change you made.
Create the Pull Request
Click the Create pull request button to submit. Arduino's library management system will then automatically check whether your library meets the requirements. If there are no problems, the Pull Request will be merged and your library will be installable through the Library Manager within a day.
5.4 Handling check results and errors
Automatic checks
Once you submit the Pull Request, Arduino's automatic checking system starts checking your library for compliance. The checks cover the library's structure, the format of the library.properties file, the version number, documentation and so on.
When the checks fail or find problems
If the problem is with the Pull Request itself, the bot will leave a comment on the Pull Request telling you what needs to be changed. You can fix it by editing the files in your Fork repository and committing the update.
If the problem is with the library itself, you need to fix it in your library's GitHub repository, update the version number in the library.properties file, and make sure the library has a valid Release or Tag (see the requirements below). After fixing it, create a new Release or Tag and notify ArduinoBot to trigger the automatic check.
Resubmitting after fixing the problem
If it is a Pull Request problem, commit your new changes once you have made them, and the automatic check will run again.
If it is a problem with the library itself, after fixing it and updating the version, create a new Release or Tag and notify ArduinoBot, and the check will run again.
Resubmitting and passing review
As soon as the checks pass, the Pull Request will be merged and your library will be available to all users through the Library Manager within a day.
https://github.com/arduino/library-registry/pull/5863
We can also view the library's logs in the Library Manager indexer:
http://downloads.arduino.cc/libraries/logs/github.com/leezisheng/SerialServo/
5.5 Verifying in Arduino
Then search for it in the library manager:
References
https://zhuanlan.zhihu.com/p/389718578