Skip to content

Commit

Permalink
ci: export all the project files (#811)
Browse files Browse the repository at this point in the history
* ci: export all the project files

* build: include the Start Scene

* fix: specify the Unity version
  • Loading branch information
homuler committed Dec 17, 2022
1 parent 37b1dab commit a4c7077
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
47 changes: 44 additions & 3 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,36 @@ jobs:
- ios-build
- windows-build
steps:
- name: Install UnityEditor
run: |
sudo docker cp $(docker create --rm unityci/editor:2021.3.3f1-base-1):/opt/unity /opt/unity
sudo chown -R $(id -u):$(id -g) /opt/unity
echo -e '#!/bin/bash\nxvfb-run -ae /dev/stdout /opt/unity/Editor/Unity -batchmode "$@"' | sudo tee -a /usr/bin/unity-editor
sudo chmod +x /usr/bin/unity-editor
- name: Generate a license activation file
run: |
unity-editor -quit -createManualActivationFile -logFile || true
- name: Request a Unity license file
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_TOTP_KEY: ${{ secrets.UNITY_TOTP_KEY }}
run: |
npm install -g unity-verify-code
git clone https://github.com/homuler/unity-license-activate.git
cd unity-license-activate
npm install
cd ..
npm install -g ./unity-license-activate
unity-license-activate "$UNITY_EMAIL" "$UNITY_PASSWORD" Unity_v2021.3.3f1.alf --authenticator-key "$UNITY_TOTP_KEY"
rm -rf unity-license-activate
- name: Activate License
run: |
unity-editor -quit -batchmode -nographics -logFile -manualLicenseFile $(ls Unity_*.ulf) || true
rm Unity_*.ulf
- name: Download the base package
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -209,17 +239,28 @@ jobs:
rm libopencv_world.*.meta
rm opencv_world*.dll.meta
- name: Package
- name: Zip all
run: |
zip -r MediaPipeUnityPlugin-all.zip .
- name: Export tarball
run: |
cd Packages/com.github.homuler.mediapipe
npm pack
mv com.github.homuler.mediapipe-*.tgz ../..
- name: Upload the built package
- name: Export unitypackage
run: |
unity-editor -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.packageName }}
path: com.github.homuler.mediapipe-*.tgz
path: |
com.github.homuler.mediapipe-*.tgz
*.unitypackage
MediaPipeUnityPlugin-all.zip
retention-days: 7

clean:
Expand Down
3 changes: 1 addition & 2 deletions Assets/MediaPipeUnity/Editor/PackageExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public static void Export()
var exportPath = "./" + fileName;

var pluginAssets = EnumerateAssets(Path.Combine("Packages", "com.github.homuler.mediapipe")); // export all the files
var sampleAssets = EnumerateAssets(Path.Combine("Assets", "MediaPipeUnity", "Samples"), new string[] { ".cs", ".unity" })
.Where(x => Path.GetFileName(x) != "Start Scene.unity"); // exclude the 'Start Scene'
var sampleAssets = EnumerateAssets(Path.Combine("Assets", "MediaPipeUnity", "Samples"), new string[] { ".cs", ".unity" });
var tutorialAssets = EnumerateAssets(Path.Combine("Assets", "MediaPipeUnity", "Tutorial")); // export all the files
var assets = pluginAssets.Concat(sampleAssets).Concat(tutorialAssets).ToArray();

Expand Down
3 changes: 1 addition & 2 deletions Packages/com.github.homuler.mediapipe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
],
"scripts": {
"setupSampleDir": "rm -rf $(npm prefix)/Samples~ && mkdir -p $(npm prefix)/Samples~",
"removeStartScene": "rm \"$(npm prefix)/Samples~/Solutions/Scenes/Start Scene.unity\" && rm \"$(npm prefix)/Samples~/Solutions/Scenes/Start Scene.unity.meta\"",
"copySolutionSamples": "cp -r $(npm prefix)/../../Assets/MediaPipeUnity/Samples $(npm prefix)/Samples~/Solutions && npm run removeStartScene",
"copySolutionSamples": "cp -r $(npm prefix)/../../Assets/MediaPipeUnity/Samples $(npm prefix)/Samples~/Solutions",
"copyTutorial": "cp -r $(npm prefix)/../../Assets/MediaPipeUnity/Tutorial $(npm prefix)/Samples~/Tutorial",
"prepack": "npm run setupSampleDir && npm run copySolutionSamples && npm run copyTutorial",
"postpack": "rm -rf $(npm prefix)/Samples~"
Expand Down

0 comments on commit a4c7077

Please sign in to comment.