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: Package and Release | |
on: | |
push: | |
pull_request: | |
create: | |
ref_type: tag | |
workflow_dispatch: | |
env: | |
dtPackageName: "com.chocopoi.vrc.dressingtools" | |
dkPackageName: "com.chocopoi.vrc.dressingframework" | |
alPackageName: "com.chocopoi.vrc.avatarlib" | |
permissions: | |
contents: write | |
jobs: | |
unity-packaging: | |
name: Unity Packaging | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Prepare Unity Project | |
run: | | |
rm -rf Tests~ docs~ logo~ | |
mkdir -p .github/unity-project/Packages/${{ env.dtPackageName }} | |
mv [!.github]* .github/unity-project/Packages/${{ env.dtPackageName }}/ | |
mv .github/unity-project/* . | |
rm -rf .github/unity-project | |
ls -l | |
ls -l Packages/${{ env.dtPackageName }} | |
- name: Prepare VPM CLI | |
run: | | |
mv Packages/vpm-manifest.2022.3.6f1.json Packages/vpm-manifest.json | |
dotnet tool install --global vrchat.vpm.cli | |
vpm add repo https://vpm.chocopoi.com/index.json | |
- name: Allow VPM Prerelease Packages | |
if: ${{ github.ref_type != 'tag' }} | |
run: | | |
tmp=$(mktemp) | |
jq '.showPrereleasePackages = true' ~/.local/share/VRChatCreatorCompanion/settings.json > "$tmp" && mv "$tmp" ~/.local/share/VRChatCreatorCompanion/settings.json | |
- name: Resolve VPM Project | |
run: | | |
vpm add package com.chocopoi.vrc.avatarlib | |
vpm add package com.chocopoi.vrc.dressingframework | |
vpm resolve project | |
jq '.version' Packages/${{env.alPackageName}}/package.json | |
jq '.version' Packages/${{env.dkPackageName}}/package.json | |
- name: Obtain package version | |
id: version | |
uses: notiz-dev/github-action-json-property@7c8cf5cc36eb85d8d287a8086a39dac59628eb31 | |
with: | |
path: "Packages/${{env.dtPackageName}}/package.json" | |
prop_path: "version" | |
- name: Set Environment Variables | |
run: | | |
echo "zipFile=${{ env.dtPackageName }}-${{ steps.version.outputs.prop }}".zip >> $GITHUB_ENV | |
echo "singleUnityPackage=${{ env.dtPackageName }}-${{ steps.version.outputs.prop }}.unitypackage" >> $GITHUB_ENV | |
echo "unityPackageWithDeps=DressingTools-${{ steps.version.outputs.prop }}-with-deps.unitypackage" >> $GITHUB_ENV | |
- name: Create Zip | |
uses: thedoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657 | |
with: | |
type: "zip" | |
exclusions: 'Doxyfile* *.bat*' | |
directory: "Packages/${{env.dtPackageName}}/" | |
filename: "../../${{env.zipFile}}" # make the zip file two directories up, since we start two directories in above | |
- run: find Packages/${{env.dtPackageName}}/ -name \*.meta -not -path '*/.github/*' -not -path '*/Tests~/*' -not -path '*/Tests/*' >> singleMetaList | |
# - run: find Packages/${{env.dtPackageName}}/ Packages/${{env.dkPackageName}}/ Packages/${{env.alPackageName}}/ -name \*.meta -not -path '*/.github/*' -not -path '*/Tests~/*' -not -path '*/Tests/*' >> withDepsMetaList | |
- name: Create Single UnityPackage | |
uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b | |
with: | |
package-path: ${{ env.singleUnityPackage }} | |
include-files: singleMetaList | |
# - name: Create With Deps UnityPackage | |
# uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b | |
# with: | |
# package-path: ${{ env.unityPackageWithDeps }} | |
# include-files: withDepsMetaList | |
# upload artifact | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: DT-${{ steps.version.outputs.prop }} | |
path: | | |
${{ env.zipFile }} | |
${{ env.singleUnityPackage }} | |
# ${{ env.unityPackageWithDeps }} | |
Packages/${{ env.dtPackageName }}/package.json | |
# create release | |
- name: Release prerelease | |
uses: poi-vrc/action-gh-release@v1 | |
if: ${{ github.ref_type == 'tag' }} | |
with: | |
files: | | |
${{ env.zipFile }} | |
${{ env.singleUnityPackage }} | |
# ${{ env.unityPackageWithDeps }} | |
Packages/${{ env.dtPackageName }}/package.json |