From 06ec916cc6654c6b477e218aa03d62872c559127 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Mon, 8 Apr 2024 17:01:22 +0200 Subject: [PATCH] Avoid using variables in workflow --- .github/workflows/build.yml | 21 +++++++-------------- package.json | 2 +- scripts/install.sh | 4 +--- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b242a83..322664c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,16 +44,10 @@ jobs: needs: build_jupyter-chat strategy: matrix: - extension: [collaborative, websocket] + extension: [collaborative, ws] name: Build ${{ matrix.extension }} chat extension steps: - - name: Create variables - run: | - [ "${{ matrix.extension }}" = "websocket" ] && echo "PACKAGE=jupyterlab_ws_chat" || echo "PACKAGE=jupyterlab_${{ matrix.extension }}_chat" >> $GITHUB_ENV - [ "${{ matrix.extension }}" = "websocket" ] && echo "DIRECTORY=packages/jupyterlab-ws-chat" || echo "DIRECTORY=packages/jupyterlab-${{ matrix.extension }}-chat" >> $GITHUB_ENV - echo $GITHUB_ENV - - name: Checkout uses: actions/checkout@v3 @@ -68,19 +62,18 @@ jobs: jlpm install jlpm build:${{ matrix.extension }} - - name: Package $PACKAGE - working-directory: $DIRECTORY + - name: Package extension run: | set -eux - pip install build - python -m build - pip uninstall -y "$PACKAGE" jupyterlab + pip install build packages/jupyterlab-${{ matrix.extension }}-chat + python -m build jupyterlab-${{ matrix.extension }}-chat + pip uninstall -y "jupyterlab_${{ matrix.extension }}_chat" jupyterlab - - name: Upload $PACKAGE package + - name: Upload package uses: actions/upload-artifact@v3 with: name: package-artifacts - path: $DIRECTORY/dist/$PACKAGE* + path: packages/jupyterlab-${{ matrix.extension }}-chat/dist/jupyterlab_${{ matrix.extension }}_chat* if-no-files-found: error check_links: diff --git a/package.json b/package.json index 467827b..765dd8a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "build": "lerna run build --stream", "build:core": "lerna run build --stream --scope \"chat-jupyter\"", "build:collaborative": "lerna run build --scope=jupyterlab-collaborative-chat --include-filtered-dependencies", - "build:websocket": "lerna run build --scope=jupyterlab-ws-chat --include-filtered-dependencies", + "build:ws": "lerna run build --scope=jupyterlab-ws-chat --include-filtered-dependencies", "build:prod": "lerna run build:prod --stream", "clean": "lerna run clean", "clean:all": "lerna run clean:all", diff --git a/scripts/install.sh b/scripts/install.sh index 97b03db..ffd0949 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -4,9 +4,6 @@ EXTENSION=$1 -[ "${EXTENSION}" = "websocket" ] && PACKAGE="jupyterlab-ws-chat" || PACKAGE="jupyterlab-${EXTENSION}-chat" - - # install core packages pip install jupyterlab~=4.0 jlpm install @@ -19,6 +16,7 @@ if [ -z "${EXTENSION}" ]; then # install websocket chat extension pip install -e packages/jupyterlab-ws-chat[test] else + PACKAGE="jupyterlab-${EXTENSION}-chat" jlpm build:${EXTENSION} pip install -e packages/${PACKAGE}[test] fi