Skip to content

Commit

Permalink
Merge pull request #25 from esnya/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
esnya authored Sep 18, 2023
2 parents f8029f3 + 4f9d1d8 commit b0351dc
Show file tree
Hide file tree
Showing 15 changed files with 1,502 additions and 1,021 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.prefab filter=usharp-prefab diff=usharp-prefab merge=unityyamlmerge eol=lf text
*.asset filter=usharp-prefab diff=usharp-prefab merge=unityyamlmerge eol=lf text
10 changes: 10 additions & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[filter "usharp-prefab"]
smudge = node .gitscripts/filter-usharp-prefab.js
clean = node .gitscripts/filter-usharp-prefab.js

[diff "usharp-prefab"]
textconv = node .gitscripts/filter-usharp-prefab.js

[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.4.31f1\\Editor\\Data\\Tools\\UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
72 changes: 71 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,84 @@
name: Release
on: push

env:
packageName: "com.nekometer.esnya.udon-sun-controller"

permissions:
contents: write

jobs:
release:
semantic-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- run: npm ci

- id: prev_version
uses: notiz-dev/github-action-json-property@7c8cf5cc36eb85d8d287a8086a39dac59628eb31
with:
path: "Packages/${{env.packageName}}/package.json"
prop_path: "version"

- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- id: version
uses: notiz-dev/github-action-json-property@7c8cf5cc36eb85d8d287a8086a39dac59628eb31
with:
path: "Packages/${{env.packageName}}/package.json"
prop_path: "version"
outputs:
prev_version: ${{ steps.prev_version.outputs.prop }}
next_version: ${{ steps.version.outputs.prop }}

vcc-release:
runs-on: ubuntu-latest
needs: semantic-release
if: needs.semantic-release.outputs.prev_version != needs.semantic-release.outputs.next_version
steps:
- uses: actions/checkout@v3
- run: echo "version=${{ needs.semantic-release.outputs.next_version }}" >> $GITHUB_ENV

- run: |
echo "zipFile=${{ env.packageName }}-${{ env.version }}".zip >> $GITHUB_ENV
echo "unityPackage=${{ env.packageName }}-${{ env.version }}.unitypackage" >> $GITHUB_ENV
- uses: thedoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657
with:
type: "zip"
directory: "Packages/${{env.packageName}}/"
filename: "../../${{env.zipFile}}" # make the zip file two directories up, since we start two directories in above

- run: find "Packages/${{env.packageName}}/" -name \*.meta >> metaList
- uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b
with:
package-path: ${{ env.unityPackage }}
include-files: metaList

- uses: svenstaro/upload-release-action@v2
with:
tag: v${{ env.version }}
file: ${{ env.zipFile }}
- uses: svenstaro/upload-release-action@v2
with:
tag: v${{ env.version }}
file: ${{ env.unityPackage }}
- uses: svenstaro/upload-release-action@v2
with:
tag: v${{ env.version }}
file: Packages/${{ env.packageName }}/package.json
- run: |
TOKEN=${{ secrets.VCC_PACKAGES_TOKEN }}
OWNER=esnya
REPO=vcc-packages
curl \
-X POST \
-H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$OWNER/$REPO/dispatches \
-d '{"event_type":"build-listing","client_payload":{}}'
28 changes: 28 additions & 0 deletions .gitscripts/filter-usharp-prefab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const fs = require("fs");

const guidPattern = '\\{fileID: .*(\n *type: [0-9]+)?\\}';
const pattern = new RegExp(
[
` - target: ${guidPattern}\n`,
" propertyPath: (serializedProgramAsset|serializationData\\..*)\n",
" value:.*\n",
` objectReference: ${guidPattern}\n`,
"|",
` +serialized(Udon)?ProgramAsset: ${guidPattern}\n`,
"|",
` serializedProgramBytesString: .*\n?`,
"|",
" SerializedFormat: [02]\n",
].join(""),
"mg"
);

const input = process.argv[2]
? fs.createReadStream(process.argv[2])
: process.stdin;

const chunks = [];
input.on("data", (chunk) => chunks.push(chunk));
input.on("end", () => {
process.stdout.write(Buffer.concat(chunks).toString().replace(pattern, ""));
});
Loading

0 comments on commit b0351dc

Please sign in to comment.