diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2cb3c03e..84a25f99 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,11 @@ name: Build on: - - push - - pull_request - - workflow_dispatch + push: + branches: + - master + pull_request: + workflow_dispatch: jobs: lint: @@ -33,7 +35,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install "reacton[generate]" ipyvue + pip install "reacton[generate]" ipyvue "jupyterlab~=3.0" - name: build wheel run: python -m build @@ -44,6 +46,10 @@ jobs: python -m ipyvuetify.components diff ipyvuetify/components.py ipyvuetify/components-previous.py + - name: Package js + run: (cd js && npm pack) + - name: show files + run: find . - name: Upload build artifacts uses: actions/upload-artifact@v3 with: @@ -103,9 +109,51 @@ jobs: name: ipyvuetify-test-results path: test-results + release-dry-run: + needs: [test] + runs-on: ubuntu-20.04 + steps: + - uses: actions/download-artifact@v3 + with: + name: ipyvuetify-dist-${{ github.run_number }} + + - name: Show files + run: find . + - name: Install node + uses: actions/setup-node@v1 + with: + node-version: "14.x" + registry-url: "https://registry.npmjs.org" + + # - name: Install Python + # uses: actions/setup-python@v2 + # with: + # python-version: 3.8 + + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install twine wheel jupyter-packaging jupyterlab + + # - name: Publish the Python package + # env: + # TWINE_USERNAME: __token__ + # TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + # run: twine upload --skip-existing dist/* + + - name: Publish the NPM package + run: | + cd js + echo $PRE_RELEASE + if [[ $PRE_RELEASE == "true" ]]; then export TAG="next"; else export TAG="latest"; fi + npm publish --dry-run --tag ${TAG} --access public *.tgz + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + PRE_RELEASE: ${{ github.event.release.prerelease }} + release: if: startsWith(github.event.ref, 'refs/tags/v') - needs: [test] + needs: [release-dry-run] runs-on: ubuntu-20.04 steps: - uses: actions/download-artifact@v3 @@ -136,6 +184,7 @@ jobs: - name: Publish the NPM package run: | + cd js echo $PRE_RELEASE if [[ $PRE_RELEASE == "true" ]]; then export TAG="next"; else export TAG="latest"; fi npm publish --tag ${TAG} --access public *.tgz diff --git a/MANIFEST.in b/MANIFEST.in index 27bffa61..1292c3e3 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,3 +5,9 @@ include jupyter-vuetify.json recursive-include ipyvuetify/extra *.vue recursive-include generate_source/ *.* recursive-include js/ *.* +prune js/node_modules +prune js/dist +prune js/lib +prune generate_source/node_modules +prune generate_source/dist +prune generate_source/lib diff --git a/js/package.json b/js/package.json index 1223f1e2..c210b4d0 100755 --- a/js/package.json +++ b/js/package.json @@ -32,7 +32,7 @@ "watch:webpack": "webpack --mode development --watch", "watch": "run-p watch:*", "clean": "rimraf lib/ dist/", - "prepare": "run-s build:*", + "build": "run-s build:*", "test": "echo \"Error: no test specified\" && exit 1" }, "devDependencies": { diff --git a/setup.py b/setup.py index b68c9297..a11da0f6 100644 --- a/setup.py +++ b/setup.py @@ -31,8 +31,9 @@ class DecoratedCommand(command): def run(self): """Run the command""" - NPMPackage(ROOT / "js" / "package.json").install() + NPMPackage(ROOT / "js" / "package.json")._run_npm("ci") generate_source.generate() + NPMPackage(ROOT / "js" / "package.json").run_script("build") self.distribution.data_files = get_data_files() command.run(self)