Skip to content

Commit

Permalink
ci: fix npm release
Browse files Browse the repository at this point in the history
  • Loading branch information
mariobuikhuizen committed Feb 26, 2024
1 parent 33176c3 commit 0ace624
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
59 changes: 54 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Build

on:
- push
- pull_request
- workflow_dispatch
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
lint:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 0ace624

Please sign in to comment.