upm-template
upm-template copied to clipboard
A template for making UPM based Unity packages
upm-template
A template project for making UPM packages for Unity
How to use
First use this repository as the base of your UPM project repository by forking it.
Project Structure
Let's say the name of your package directory is ABC
. Your UPM project directory will usually be Packages/ABC
or Assets/ABC
(let's assume it's Packages/ABC
for this guide). A sample directory is included in the repo.
Inside which you'd have your package.json
, CHANGELOG.md
, LICENSE
, README.md
.
To know more about package.json
(called the UPM Manifest) go here
Configure Github Actions (only works when hosting on github.com)
Go to .github/workflows/ci.yml
and change the value of XYZ
to Packages/ABC
.
If your branch name differs from 'master' and is for example 'main' replace:
on:
push:
branches:
- master
with:
on:
push:
branches:
- main
Every time you commit to master
, this YML file is used to release your UPM package and automatically use a separate upm branch for releases as well as autogenerate tag for release. If you see the upm branch commits, you'll notice that your project directory is the root instead of the Unity project directory. Github Actions is used to automate this bit.
Configure Semantic Release
Semantic releases is used to automate changelog updates as well as incrementing the version field inside package.json
(the UPM Manifest).
Go to .releaserc.yml
do make the following changes:
-
XYZ1
toPackages/ABC
-
XYZ2
toPackages/ABC/package.json
-
XYZ3
toPackages/ABC/CHANGELOG.md
- 'PATH_TO_YOUR_CHANGELOG.MD' to
Packages/ABC/CHANGELOG.md
When using git commit
, follow the Angular Standard
Publishing to package registries
Use npm publish
inside Packages/ABC
or check out OpenUPM
Further Resources
Favo Yang's Medium Articles
OpenUPM Docs
Having a Docker Container As Your Private NPM Registry — The Easy Way by Sibeesh Venu