forked from BenoitFreslon/Vibration
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Chore] Unity project with UPM embedded structure
Also: [VSCode] - Migrate to use the new extension "visualstudiotoolsforunity.vstuc" - Added a default Unity editor debug configuration to `.vscode/launch.json` [WebGL] - Refactoring to a more "vanilla" Javascript approach using a `Vibration` singleton class - Added `IsVibrateSupported()` method to main `.jslib` - Added `repeat` parameter to `VibrateWithPattern()` method on main `.jslib` - Added a package.json file to the root embedded Unity project, to run and test WebGL builds [Android] - Added a generic static C# class for `AndroidBuild` to get Android API level [Unity/C#] - Refactorings to better accomplish the scene example script `VibrationExample.cs` - Added Editor unit tests in order to test `MobileTimeUnit.cs` class - Refactoring on `Samples/VibrationExample` to consider use WebGL implementations as well
- Loading branch information
1 parent
49a398e
commit 8ba7ba9
Showing
202 changed files
with
6,410 additions
and
1,907 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
|
||
# USAGE: packageVersion "[PATH]/package.json" | ||
packageVersion() { | ||
local PACKAGE_JSON_FILE=$1 | ||
VERSION="" | ||
while read a b ; do | ||
[ "$a" = '"version":' ] && { b="${b%\"*}" ; VERSION="${b#\"}" ; break ; } | ||
done < $PACKAGE_JSON_FILE | ||
echo $VERSION | ||
} | ||
|
||
githubActionsOutputs() { | ||
CURRENT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
COMMIT_MESSAGE=$(git log -1 --pretty=%B) | ||
echo ::set-output name=tag::$CURRENT_TAG | ||
echo ::set-output name=commit_message::$COMMIT_MESSAGE | ||
} | ||
|
||
copyPackagesContent() { | ||
shopt -s extglob dotglob | ||
cp -rvf "Packages/$PKG_NAME/." "$PKG_ROOT" | ||
rm -rf ./Packages | ||
} | ||
|
||
commitAndPush() { | ||
# Incrementing LAST_RELEASE_TAG+1. | ||
# Keep here just to store the history, and if need this to the future/others repositories | ||
# | ||
# PS: Keep in mind that not always you would like to increment the git tag version (e.g rewriting with force an existent git tag) | ||
# [[ "$LAST_RELEASE_TAG" =~ (.*[^0-9])([0-9]+)$ ]] && LAST_RELEASE_TAG="${BASH_REMATCH[1]}$((${BASH_REMATCH[2]} + 1))"; | ||
|
||
RELEASE_VERSION=$(packageVersion "./package.json") | ||
|
||
echo "New version: $RELEASE_VERSION" | ||
|
||
if [[ -d "Samples" ]]; then | ||
mv Samples Samples~ | ||
rm -f Samples.meta | ||
fi | ||
if [[ -d "Documentation" ]]; then | ||
mv Documentation Documentation~ | ||
rm -f Documentation.meta | ||
fi | ||
git config --global user.name 'github-bot' | ||
git config --global user.email '[email protected]' | ||
git add . | ||
git commit --allow-empty -am "$COMMIT_MESSAGE" | ||
|
||
echo $RELEASE_VERSION > VERSION.md~ | ||
git add VERSION.md~ | ||
git commit -am "fix: Samples => Samples~ and commit a new version: $RELEASE_VERSION" | ||
git push -f -u origin "$PKG_BRANCH" | ||
} | ||
|
||
run() { | ||
if [ $1 == "push" ] | ||
then | ||
commitAndPush | ||
elif [ $1 == "movePackagesFolder" ] | ||
then | ||
copyPackagesContent | ||
elif [ $1 == "githubActionsVariables" ] | ||
then | ||
githubActionsOutputs | ||
else | ||
echo "[ERROR] INVALID SCRIPT OPERATION" | ||
exit 1 | ||
fi | ||
} | ||
|
||
run $1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,38 +2,41 @@ name: Unity Package CI | |
on: | ||
push: | ||
branches: | ||
- upm-android-haptics | ||
- upm-package-embedded | ||
repository_dispatch: | ||
types: [on-demand-test] | ||
env: | ||
PKG_ROOT: ./ | ||
PKG_BRANCH: upm | ||
PKG_NAME: com.benoitfreslon.vibration | ||
PKG_ROOT: ./ | ||
jobs: | ||
split-upm: | ||
name: Split upm branch (force) | ||
name: Create upm package branch (force) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Split package folder to upm branch | ||
run: | | ||
if [ "$PKG_ROOT" == "./" ] | ||
then | ||
git checkout -b upm | ||
else | ||
git subtree split -P "$PKG_ROOT" -b upm | ||
fi | ||
- name: Create samples~ folder | ||
run: | | ||
git checkout upm | ||
if [[ -d "Samples" ]]; then | ||
git mv Samples Samples~ | ||
rm -f Samples.meta | ||
git config --global user.name 'github-bot' | ||
git config --global user.email '[email protected]' | ||
git commit -am "fix: Samples => Samples~" | ||
fi | ||
- name: Push changes to upm branch | ||
uses: ad-m/github-push-action@master | ||
with: | ||
force: true | ||
branch: upm | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set output git tag and commit message | ||
id: vars | ||
run: ./.github/scripts/functions.sh githubActionsVariables | ||
- name: Check output git variables | ||
env: | ||
LAST_RELEASE_TAG: ${{ steps.vars.outputs.tag }} | ||
COMMIT_MESSAGE: ${{ steps.vars.outputs.commit_message }} | ||
run: | | ||
echo $LAST_RELEASE_TAG | ||
echo $COMMIT_MESSAGE | ||
- name: Checkout orphan [${{ env.PKG_BRANCH }}] branch | ||
run: | | ||
git checkout --orphan "$PKG_BRANCH" | ||
shopt -s extglob dotglob | ||
rm -rf !(Packages|.github|.git|README.md|README.md.meta|LICENSE|LICENSE.meta|.|..) | ||
ls -la ./ | ||
- name: Move ./Packages content to root | ||
run: ./.github/scripts/functions.sh movePackagesFolder | ||
- name: Create Samples~ and Documentation~ folders | ||
run: ./.github/scripts/functions.sh push | ||
env: | ||
LAST_RELEASE_TAG: ${{ steps.vars.outputs.tag }} | ||
COMMIT_MESSAGE: ${{ steps.vars.outputs.commit_message }} |
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
Oops, something went wrong.