An open API service indexing awesome lists of open source software.

https://github.com/foxscore/add-icon-to-unitypackage

A GitHub action that adds an icon to you UnityPackage file
https://github.com/foxscore/add-icon-to-unitypackage

Last synced: 6 months ago
JSON representation

A GitHub action that adds an icon to you UnityPackage file

Awesome Lists containing this project

README

          

# Set UnityPackage Import Thumbnail

![example image](resources/example.png)

## Licensing

- Licensed under [GNU GPL v3 or later](https://spdx.org/licenses/GPL-3.0-or-later.html).
- The contents of the `dist` folder are unlincensed, and are generated by [ncc](https://www.npmjs.com/package/@vercel/ncc).

## Inputs

| Required | Parameter | Description | Type | Default |
| :------: | :------------------------------ | :------------------------------------------- | :---------------------- | :------ |
| ✓ | `package_path` | Path to the UnityPackage. | `string` | |
| ✓ | `icon_path` | Path to the icon file. Must be a `png`. | `string` | |
| | `package_not_found_behavior` | What to do if the package file is not found. | [`behavior`](#behavior) | `fail` |
| | `icon_not_found_behavior` | What to do if the icon file is not found. | [`behavior`](#behavior) | `fail` |
| | `icon_already_present_behavior` | What to do if an icon is already present. | [`behavior`](#behavior) | `fail` |

### Behavior

| Value | Description |
| -------- | ------------------------------------ |
| `fail` | Throws an error, stops the workflow. |
| `warn` | Prints a warning, skips this action. |
| `ignore` | Do nothing, skip this action. |

## Setup

Add the following snippet to your workflow file, with the appropriate parameters:

```yml
- name: Add Icon to UnityPackage
uses: foxscore/add-icon-to-unitypackage@v1
with:
package_path: 'path/to/your/package.unitypackage'
icon_path: 'path/to/your/icon.png'
package_not_found_behavior: 'fail'
icon_not_found_behavior: 'fail'
icon_already_present_behavior: 'fail'
```

### Example

> **Assuming that you**
>
> - have a file called `icon.png` in the `resources` folder.
> - are using the [VPM Package Template](https://github.com/vrchat-community/template-package), in which case the file to edit is `.github/workflows/release.yml`.

```yml
# [...]

- name: Create UnityPackage
uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b
with:
package-path: ${{ env.unityPackage }}
include-files: metaList

# This is where we insert the action
- name: Add Icon to UnityPackage
uses: foxscore/add-icon-to-unitypackage@v1
with:
package_path: ${{ env.unityPackage }}
icon_path: 'resources/icon.png'
# end of action

- name: Make Release
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
with:
tag_name: ${{ steps.version.outputs.prop }}
files: |
${{ env.zipFile }}
${{ env.unityPackage }}
Packages/${{ env.packageName }}/package.json
```