generated from vrchat-community/template-package
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0f1d852
Showing
49 changed files
with
3,462 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Build Repo Listing | ||
|
||
env: | ||
listPublishDirectory: Website | ||
pathToCi: ci | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_run: | ||
workflows: [Build Release] | ||
types: | ||
- completed | ||
release: | ||
types: [published, created, edited, unpublished, deleted, released] | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
# Build the VPM Listing Website and deploy to GitHub Pages | ||
build-listing: | ||
name: build-listing | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
# Checkout Local Repository | ||
- name: Checkout Local Repository | ||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac | ||
|
||
# Checkout Automation Repository without removing prior checkouts | ||
- name: Checkout Automation Repository | ||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac | ||
with: | ||
repository: vrchat-community/package-list-action | ||
path: ${{ env.pathToCi }} | ||
clean: false | ||
|
||
# Load cached data from previous runs | ||
- name: Restore Cache | ||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 | ||
with: | ||
path: | | ||
${{ env.pathToCi }}/.nuke/temp | ||
~/.nuget/packages | ||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} | ||
|
||
# Build Package Version Listing with Nuke | ||
- name: Build Package Version Listing | ||
run: ${{ env.pathToCi }}/build.cmd BuildRepoListing --root ${{ env.pathToCi }} --list-publish-directory $GITHUB_WORKSPACE/${{ env.listPublishDirectory }} --current-package-name ${{ vars.PACKAGE_NAME }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Prepare for GitHub Pages deployment | ||
- name: Setup Pages | ||
uses: actions/configure-pages@f156874f8191504dae5b037505266ed5dda6c382 | ||
|
||
# Upload the VPM Listing Website to GitHub Pages artifacts | ||
- name: Upload Pages Artifact | ||
uses: actions/upload-pages-artifact@a753861a5debcf57bf8b404356158c8e1e33150c | ||
with: | ||
path: ${{ env.listPublishDirectory }} | ||
|
||
# Deploy the uploaded VPM Listing Website to GitHub Pages | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@9dbe3824824f8a1377b8e298bafde1a50ede43e5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Build Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
# Validate Repository Configuration | ||
config: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
config_package: ${{ steps.config_package.outputs.configPackage }} | ||
steps: | ||
|
||
# Ensure that required repository variable has been created for the Package | ||
- name: Validate Package Config | ||
id: config_package | ||
run: | | ||
if [ "${{ vars.PACKAGE_NAME }}" != "" ]; then | ||
echo "configPackage=true" >> $GITHUB_OUTPUT; | ||
else | ||
echo "configPackage=false" >> $GITHUB_OUTPUT; | ||
fi | ||
# Build and release the Package | ||
# If the repository is not configured properly, this job will be skipped | ||
build: | ||
needs: config | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
env: | ||
packagePath: Packages/${{ vars.PACKAGE_NAME }} | ||
if: needs.config.outputs.config_package == 'true' | ||
steps: | ||
|
||
# Checkout Local Repository | ||
- name: Checkout | ||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac | ||
|
||
# Get the Package version based on the package.json file | ||
- name: Get Version | ||
id: version | ||
uses: zoexx/github-action-json-file-properties@b9f36ce6ee6fe2680cd3c32b2c62e22eade7e590 | ||
with: | ||
file_path: "${{ env.packagePath }}/package.json" | ||
prop_path: "version" | ||
|
||
# Configure the Environment Variables needed for releasing the Package | ||
- name: Set Environment Variables | ||
run: | | ||
echo "zipFile=${{ vars.PACKAGE_NAME }}-${{ steps.version.outputs.value }}".zip >> $GITHUB_ENV | ||
echo "unityPackage=${{ vars.PACKAGE_NAME }}-${{ steps.version.outputs.value }}.unitypackage" >> $GITHUB_ENV | ||
echo "version=${{ steps.version.outputs.value }}" >> $GITHUB_ENV | ||
# Zip the Package for release | ||
- name: Create Package Zip | ||
working-directory: "${{ env.packagePath }}" | ||
run: zip -r "${{ github.workspace }}/${{ env.zipFile }}" . | ||
|
||
# Build a list of .meta files for future use | ||
- name: Track Package Meta Files | ||
run: find "${{ env.packagePath }}/" -name \*.meta >> metaList | ||
|
||
# Make a UnityPackage version of the Package for release | ||
- name: Create UnityPackage | ||
uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b | ||
with: | ||
package-path: ${{ env.unityPackage }} | ||
include-files: metaList | ||
|
||
# Make a release tag of the version from the package.json file | ||
- name: Create Tag | ||
id: tag_version | ||
uses: rickstaa/action-create-tag@88dbf7ff6fe2405f8e8f6c6fdfd78829bc631f83 | ||
with: | ||
tag: "${{ env.version }}" | ||
|
||
# Publish the Release to GitHub | ||
- name: Make Release | ||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | ||
with: | ||
files: | | ||
${{ env.zipFile }} | ||
${{ env.unityPackage }} | ||
${{ env.packagePath }}/package.json | ||
tag_name: ${{ env.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# This .gitignore file should be placed at the root of your Unity project directory | ||
# | ||
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore | ||
# | ||
/[Ll]ibrary/ | ||
/[Tt]emp/ | ||
/[Oo]bj/ | ||
/[Bb]uild/ | ||
/[Bb]uilds/ | ||
/[Ll]ogs/ | ||
/[Mm]emoryCaptures/ | ||
|
||
# Asset meta data should only be ignored when the corresponding asset is also ignored | ||
!/[Aa]ssets/**/*.meta | ||
|
||
# Uncomment this line if you wish to ignore the asset store tools plugin | ||
# /[Aa]ssets/AssetStoreTools* | ||
|
||
# Autogenerated Jetbrains Rider plugin | ||
[Aa]ssets/Plugins/Editor/JetBrains* | ||
|
||
# Visual Studio cache directory | ||
.vs/ | ||
|
||
# Gradle cache directory | ||
.gradle/ | ||
|
||
# Autogenerated VS/MD/Consulo solution and project files | ||
ExportedObj/ | ||
.consulo/ | ||
*.csproj | ||
*.unityproj | ||
*.sln | ||
*.suo | ||
*.tmp | ||
*.user | ||
*.userprefs | ||
*.pidb | ||
*.booproj | ||
*.svd | ||
*.pdb | ||
*.mdb | ||
*.opendb | ||
*.VC.db | ||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
*.pdb.meta | ||
*.mdb.meta | ||
|
||
# Unity3D generated file on crash reports | ||
sysinfo.txt | ||
|
||
# Builds | ||
*.apk | ||
*.unitypackage | ||
|
||
# Crashlytics generated file | ||
crashlytics-build.properties | ||
|
||
.idea/.idea.vpm-package-maker/.idea | ||
Assets/PackageMakerWindowData.asset* | ||
.idea | ||
.vscode |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/*/ | ||
!com.vrchat.core.* | ||
|
||
# Change this to match your new package name | ||
!com.vrchat.demo-template |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using System; | ||
using System.IO; | ||
using System.Net; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace VRC.PackageManagement.Core | ||
{ | ||
public class Bootstrap | ||
{ | ||
// JSON property names in Project Manifest | ||
public const string UNITY_PACKAGES_FOLDER = "Packages"; | ||
public const string UNITY_MANIFEST_FILENAME = "manifest.json"; | ||
|
||
// VRC Values | ||
public const string VRC_CONFIG = "https://api.vrchat.cloud/api/1/config"; | ||
public const string VRC_AGENT = "VCCBootstrap 1.0"; | ||
public const string VRC_RESOLVER_PACKAGE = "com.vrchat.core.vpm-resolver"; | ||
|
||
// Finds url for bootstrap package without using JSON | ||
private static Regex _bootstrapRegex = new Regex("\"bootstrap\"\\s*:\\s*\"(.+?(?=\"))\""); | ||
public static string ManifestPath => Path.Combine(Directory.GetCurrentDirectory(), UNITY_PACKAGES_FOLDER, UNITY_MANIFEST_FILENAME); | ||
|
||
// Path where we expect the target package to exist | ||
public static string ResolverPath => | ||
Path.Combine(Directory.GetCurrentDirectory(), UNITY_PACKAGES_FOLDER, VRC_RESOLVER_PACKAGE); | ||
|
||
[InitializeOnLoadMethod] | ||
public static async void CheckForRestore() | ||
{ | ||
if (!new DirectoryInfo(ResolverPath).Exists) | ||
{ | ||
try | ||
{ | ||
await AddResolver(); | ||
} | ||
catch (Exception e) | ||
{ | ||
Debug.LogError($"Could not download and install the VPM Package Resolver - you may be missing packages. Exception: {e.Message}"); | ||
} | ||
} | ||
} | ||
|
||
public static async Task AddResolver() | ||
{ | ||
var configData = await GetRemoteString(VRC_CONFIG); | ||
if (string.IsNullOrWhiteSpace(configData)) | ||
{ | ||
Debug.LogWarning($"Could not get VPM libraries, try again later"); | ||
return; | ||
} | ||
var bootstrapMatch = _bootstrapRegex.Match(configData); | ||
if (!bootstrapMatch.Success || bootstrapMatch.Groups.Count < 2) | ||
{ | ||
Debug.LogError($"Could not find bootstrap in config, try again later"); | ||
return; | ||
} | ||
|
||
var url = bootstrapMatch.Groups[1].Value; | ||
|
||
var targetFile = Path.Combine(Path.GetTempPath(), $"resolver-{DateTime.Now.ToString("yyyyMMddTHHmmss")}.unitypackage"); | ||
|
||
// Download to dir | ||
using (var client = new WebClient()) | ||
{ | ||
// Add User Agent or else CloudFlare will return 1020 | ||
client.Headers.Add(HttpRequestHeader.UserAgent, VRC_AGENT); | ||
|
||
await client.DownloadFileTaskAsync(url, targetFile); | ||
|
||
if (File.Exists(targetFile)) | ||
{ | ||
Debug.Log($"Downloaded Resolver to {targetFile}"); | ||
AssetDatabase.ImportPackage(targetFile, false); | ||
} | ||
} | ||
return; | ||
} | ||
|
||
public static async Task<string> GetRemoteString(string url) | ||
{ | ||
using (var client = new WebClient()) | ||
{ | ||
// Add User Agent or else CloudFlare will return 1020 | ||
client.Headers.Add(HttpRequestHeader.UserAgent, VRC_AGENT); | ||
return await client.DownloadStringTaskAsync(url); | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Packages/com.vrchat.core.bootstrap/Editor/Bootstrap.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
Packages/com.vrchat.core.bootstrap/Editor/VRChat.Bootstrapper.Editor.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "VRChat.Bootstrapper.Editor", | ||
"references": [], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
7 changes: 7 additions & 0 deletions
7
Packages/com.vrchat.core.bootstrap/Editor/VRChat.Bootstrapper.Editor.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# VRCHAT INC. | ||
### VRCHAT DISTRO LICENSE FILE | ||
Version: February 24, 2022 | ||
|
||
**SUMMARY OF TERMS:** Any materials subject to this Distro Asset License may be distributed by you, with or without modifications, on a non-commercial basis (i.e., at no charge), in accordance with the full terms of the Materials License Agreement. | ||
|
||
This Distro License File is a "License File" as defined in the VRChat Materials License Agreement, found at https://hello.vrchat.com/legal/sdk (or any successor link designated by VRChat) (as may be revised from time to time, the "Materials License Agreement"). | ||
|
||
This Distro License File applies to all the files in the Folder containing this Distro License File and those in all Child Folders within that Folder (except with respect to files in any Child Folder that contains a different License File) (such files, other than this Distro License File, the "Covered Files"). All capitalized terms used but not otherwise defined in this Distro License File have the meanings provided in the Materials License Agreement. | ||
|
||
This Distro License File only provides a summary of the terms applicable to the Covered Files. To understand your rights and obligations and the full set of terms that apply to use of the Covered Files, please see the relevant sections of the Materials License Agreement, including terms applicable to Distro Materials. |
Oops, something went wrong.