This repository is responsible for saving the published KCL packages, and you can find these packages on artifacthub.io (AH).
In the next section, we will show you how to publish your package with a helloworld
example.
- Install kpm
- Install git
- Register a Github account (optional, you need a github account)
NOTE: If you want to publish your KCL package to the kcl-lang official registry, then the source code of your KCL package will be saved in this repo, you need to submit the source code of your package to this repository via PR.
First, you need to clone the repository
git clone https://github.com/kcl-lang/artifacthub --depth=1
We recommend that your branch name be: publish-pkg-<pkg_name>
, <pkg_name>
is the name of your package.
Take the package helloworld
as an example
Enter the artifacthub directory you downloaded
cd artifacthub
Create a branch publish-pkg-helloworld
for the package helloworld
git checkout -b publish-pkg-helloworld
You need to move your package to the current directory. In our example, we use the kpm init
command to create the package helloworld
kpm init helloworld
You can add a README.md
file to the root directory of the package to display on the homepage of AH.
echo "## Introduction" >> helloworld/README.md
echo "This is a kcl package named helloworld." >> helloworld/README.md
You can use the following command to commit your package
Use git add .
command to add your package to the staging area of git
git add .
Use git commit -s
command to commit your package, we recommend that your commit message follow the format "publish package <pkg_name>".
git commit -m"publish package helloworld" -s
Use git push
command to submit your package to your branch publish-pkg-<pkg_name>
git push
Finally, you need to submit a PR to the main branch of the repository with your branch publish-pkg-<pkg_name>
.