vrchat-community / template-package

WIP Package Template Repository
https://vrchat-community.github.io/template-package/
58 stars 18 forks source link
packages vpm vrchat

VPM Package Template

Starter for making Packages, including automation for building and publishing them.

Once you're all set up, you'll be able to push changes to this repository and have .zip and .unitypackage versions automatically generated, and a listing made which works in the VPM for delivering updates for this package. If you want to make a listing with a variety of packages, check out our template-package-listing repo.

▶ Getting Started

🚇 Migrating Assets Package

Full details at Converting Assets to a VPM Package

✏️ Working on Your Package

🤖 Setting up the Automation

Create a repository variable with the name and value described below. For details on how to create repository variables, see Creating Configuration Variables for a Repository. Make sure you are creating a repository variable, and not a repository secret.

Finally, go to the "Settings" page for your repo, then choose "Pages", and look for the heading "Build and deployment". Change the "Source" dropdown from "Deploy from a branch" to "GitHub Actions".

That's it! Some other notes:

🎉 Publishing a Release

You can make a release by running the Build Release action. The version specified in your package.json file will be used to define the version of the release.

📃 Rebuilding the Listing

Whenever you make a change to a release - manually publishing it, or manually creating, editing or deleting a release, the Build Repo Listing action will make a new index of all the releases available, and publish them as a website hosted fore free on GitHub Pages. This listing can be used by the VPM to keep your package up to date, and the generated index page can serve as a simple landing page with info for your package. The URL for your package will be in the format https://username.github.io/repo-name.

🏠 Customizing the Landing Page (Optional)

The action which rebuilds the listing also publishes a landing page. The source for this page is in Website/index.html. The automation system uses Scriban to fill in the objects like {{ this }} with information from the latest release's manifest, so it will stay up-to-date with the name, id and description that you provide there. You are welcome to modify this page however you want - just use the existing {{ template.objects }} to fill in that info wherever you like. The entire contents of your "Website" folder are published to your GitHub Page each time.

💻 Technical Stuff

You are welcome to make your own changes to the automation process to make it fit your needs, and you can create Pull Requests if you have some changes you think we should adopt. Here's some more info on the included automation:

Build Release Action

release.yml

This is a composite action combining a variety of existing GitHub Actions and some shell commands to create both a .zip of your Package and a .unitypackage. It creates a release which is named for the version in the package.json file found in your target Package, and publishes the zip, the unitypackage and the package.json file to this release.

Build Repo Listing

build-listing.yml

This is a composite action which builds a vpm-compatible Repo Listing based on the releases you've created. In order to find all your releases and combine them into a listing, it checks out another repository which has a Nuke project which includes the VPM core lib to have access to its types and methods. This project will be expanded to include more functionality in the future - for now, the action just calls its BuildRepoListing target.