Skip to content

Commit

Permalink
feat(ci): add Node.js version check (#845)
Browse files Browse the repository at this point in the history
* feat(ci): add nodejs version check

* fix(ci): fix error
  • Loading branch information
jo-hnny committed Oct 22, 2020
1 parent c51c5d6 commit d58640e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '13.x'
node-version: '12'

- run: npm install

Expand Down
15 changes: 9 additions & 6 deletions build/lib/web.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,29 @@
# WARRANTIES OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

NPM := npm
NPM_SUPPORTED_VERSIONS ?= 6
NODE_SUPPORTED_VERSION = v12
NPM = npm

.PHONY: web.build
web.build: web.verify web.build.console web.build.installer

.PHONY: web.verify
web.verify:
ifneq ($(shell $(NPM) -v | grep -q -E '\b($(NPM_SUPPORTED_VERSIONS))\b' && echo 0 || echo 1), 0)
$(error unsupported npm version. Please make install one of the following supported version: '$(NPM_SUPPORTED_VERSIONS)')
@echo "===========> Check Node.js version"
ifneq ($(shell node -v | cut -f1 -d.), $(NODE_SUPPORTED_VERSION))
@echo "===========> Install Node.js v12"
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
endif

.PHONY: web.build.console
web.build.console:
web.build.console: web.verify
@echo "===========> Building the console web app"
@mkdir -p $(ROOT_DIR)/web/console/build
@cd $(ROOT_DIR)/web/console && $(NPM) run build

.PHONY: web.build.installer
web.build.installer:
web.build.installer: web.verify
@echo "===========> Building the installer web app"
@mkdir -p $(ROOT_DIR)/web/installer/build
@cd $(ROOT_DIR)/web/installer && $(NPM) run build

0 comments on commit d58640e

Please sign in to comment.