0.1.12 #15
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
name: Build Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: main | |
paths: package.json | |
env: | |
packageName: "dev.jetees.memoryoptimizer" | |
packagePath: "Packages/dev.jetees.memoryoptimizer" | |
packageFileName: "MemoryOptimizer" | |
packageReleaseName: "Memory Optimizer" | |
triggerRepoUpdate: ${{ true }} | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get Version | |
id: version | |
uses: zoexx/github-action-json-file-properties@b9f36ce6ee6fe2680cd3c32b2c62e22eade7e590 | |
with: | |
file_path: "./package.json" | |
prop_path: "version" | |
- name: Generate Tag | |
id: tag | |
run: echo prop="v${{ steps.version.outputs.value }}" >> $GITHUB_OUTPUT | |
- name: Check If Release Tag Exists | |
id: checkReleaseTag | |
uses: mukunku/[email protected] | |
with: | |
tag: ${{ steps.tag.outputs.prop }} | |
- name: Set Environment Variables | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
run: | | |
echo "zipFile=${{ env.packageFileName }}_v${{ steps.version.outputs.value }}".zip >> $GITHUB_ENV | |
echo "unityPackage=${{ env.packageFileName }}_v${{ steps.version.outputs.value }}.unitypackage" >> $GITHUB_ENV | |
- name: Create directory and move files | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
run: | | |
mkdir -p ${{env.packagePath}} | |
rsync -r --exclude="${{ env.packagePath }}" ./ "${{ env.packagePath }}"/ | |
- name: Create Zip | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
uses: thedoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657 | |
with: | |
type: "zip" | |
directory: "${{env.packagePath}}/" | |
filename: "../../${{env.zipFile}}" # make the zip file two directories up, since we start two directories in above | |
exclusions: "*.git* *.github* .gitignore Packages/" | |
- run: find "${{env.packagePath}}" -name \*.meta >> metaList | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
- name: Create UnityPackage | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b | |
with: | |
package-path: ${{ env.unityPackage }} | |
include-files: metaList | |
- name: Add Icon to UnityPackage | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
uses: foxscore/add-icon-to-unitypackage@v1 | |
with: | |
package_path: ${{ env.unityPackage }} | |
icon_path: '.github/thumbnail.png' | |
package_not_found_behavior: 'warn' | |
icon_not_found_behavior: 'warn' | |
icon_already_present_behavior: 'warn' | |
- name: Make Release | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
with: | |
name: "${{ env.packageReleaseName }} v${{ steps.version.outputs.value }}" | |
tag_name: "v${{ steps.version.outputs.value }}" | |
files: | | |
${{ env.zipFile }} | |
${{ env.unityPackage }} | |
./package.json | |
- name: Trigger VPM Repo Listing Update | |
if: ${{ env.triggerRepoUpdate == 'true' && steps.checkReleaseTag.outputs.exists == 'false'}} | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
event-type: trigger-repo-update |