diff --git a/.gitignore b/.gitignore index 2fd83a6a..7a1537ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ .idea node_modules -dist diff --git a/action.yml b/action.yml index 432660ac..b22b084d 100644 --- a/action.yml +++ b/action.yml @@ -10,4 +10,4 @@ branding: color: 'gray-dark' runs: using: 'node12' - main: 'src/index.js' + main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 00000000..2350318a Binary files /dev/null and b/dist/index.js differ diff --git a/dist/run-unity-builder.sh b/dist/run-unity-builder.sh new file mode 100644 index 00000000..d4cc9f36 --- /dev/null +++ b/dist/run-unity-builder.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env sh + +PROJECT_PATH=$1 +BUILD_TARGET=$2 +BUILD_NAME=$3 +BUILDS_PATH=$4 +BUILD_METHOD=$5 + +DOCKER_IMAGE_TAG=unity-builder-image + +echo "Running docker container with specific tag" + +docker build \ + --file ../Dockerfile \ + --tag DOCKER_IMAGE_TAG \ + ../ + +docker run \ + --workdir /github/workspace \ + --rm \ + --env PROJECT_PATH \ + --env BUILD_TARGET \ + --env BUILD_NAME \ + --env BUILDS_PATH \ + --env BUILD_METHOD \ + --env HOME \ + --env GITHUB_REF \ + --env GITHUB_SHA \ + --env GITHUB_REPOSITORY \ + --env GITHUB_ACTOR \ + --env GITHUB_WORKFLOW \ + --env GITHUB_HEAD_REF \ + --env GITHUB_BASE_REF \ + --env GITHUB_EVENT_NAME \ + --env GITHUB_WORKSPACE \ + --env GITHUB_ACTION \ + --env GITHUB_EVENT_PATH \ + --env RUNNER_OS \ + --env RUNNER_TOOL_CACHE \ + --env RUNNER_TEMP \ + --env RUNNER_WORKSPACE \ + --volume "/var/run/docker.sock":"/var/run/docker.sock" \ + --volume "/home/runner/work/_temp/_github_home":"/github/home" \ + --volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" \ + --volume "${PWD}":"/github/workspace" \ + DOCKER_IMAGE_TAG diff --git a/package.json b/package.json index 6f1197a4..c62b6f41 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "author": "Webber ", "license": "MIT", "scripts": { - "build": "babel src -d dist", + "build": "ncc build src/index.js -o dist -m", + "watch": "yarn build -w", "lint": "prettier --check \"src/**/*.js\" && eslint src", "test": "jest --passWithNoTests" }, @@ -19,6 +20,7 @@ "devDependencies": { "@babel/cli": "7.7.5", "@babel/core": "7.7.5", + "@zeit/ncc": "0.20.5", "babel-eslint": "10.0.3", "eslint": "6.7.2", "eslint-config-airbnb": "18.0.1", @@ -29,14 +31,14 @@ "eslint-plugin-prettier": "3.1.2", "eslint-plugin-react": "7.17.0", "eslint-plugin-unicorn": "14.0.1", - "husky": "3.1.0", + "husky": "4.0.0-beta.5", "jest": "24.9.0", "lint-staged": "9.5.0", "prettier": "1.19.1" }, "husky": { "hooks": { - "pre-commit": "lint-staged" + "pre-commit": "lint-staged && yarn build && git add dist" } }, "lint-staged": { diff --git a/yarn.lock b/yarn.lock index 62901c7b..94d3066a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -535,6 +535,11 @@ dependencies: "@types/yargs-parser" "*" +"@zeit/ncc@0.20.5": + version "0.20.5" + resolved "https://registry.yarnpkg.com/@zeit/ncc/-/ncc-0.20.5.tgz#a41af6e6bcab4a58f4612bae6137f70bce0192e3" + integrity sha512-XU6uzwvv95DqxciQx+aOLhbyBx/13ky+RK1y88Age9Du3BlA4mMPCy13BGjayOrrumOzlq1XV3SD/BWiZENXlw== + abab@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" @@ -2230,22 +2235,20 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -husky@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.1.0.tgz#5faad520ab860582ed94f0c1a77f0f04c90b57c0" - integrity sha512-FJkPoHHB+6s4a+jwPqBudBDvYZsoQW5/HBuMSehC8qDiCe50kpcxeqFoDSlow+9I6wg47YxBoT3WxaURlrDIIQ== +husky@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/husky/-/husky-4.0.0-beta.5.tgz#b89febfc0812f2de6f0e29142f147aed946fac6a" + integrity sha512-2pjLVRjXTkWoNpCFFltAiVD+qpaXDfVEldnzINgI5N7ncxY1cryFvUZnYoSQIG9NN7QDLZ6AtO/HtNObjBln6g== dependencies: chalk "^2.4.2" ci-info "^2.0.0" cosmiconfig "^5.2.1" - execa "^1.0.0" get-stdin "^7.0.0" opencollective-postinstall "^2.0.2" pkg-dir "^4.2.0" please-upgrade-node "^3.2.0" - read-pkg "^5.2.0" - run-node "^1.0.0" slash "^3.0.0" + which-pm-runs "^1.0.0" iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" @@ -4386,11 +4389,6 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" -run-node@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" - integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== - run-parallel@^1.1.9: version "1.1.9" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" @@ -5127,6 +5125,11 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= +which-pm-runs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb" + integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= + which@^1.2.9, which@^1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"