From c60d7e4eea96a826cf20bc8fbd29b14c847cba86 Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Tue, 24 Dec 2024 15:29:07 +0100 Subject: [PATCH] ci: always execute release part, and use the tested artifacts --- .github/workflows/ci_tests.yml | 48 +++++++++++++++++++++++++++++++++- .github/workflows/release.yml | 38 --------------------------- 2 files changed, 47 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index b1c2a10..c365f82 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -29,6 +29,9 @@ jobs: with: python-version: '3.x' + - name: Package js + run: (cd js && npm ci && npm run build && npm pack) + - name: Install dependencies run: | python -m pip install --upgrade pip @@ -42,7 +45,9 @@ jobs: uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: bqplot-image-gl-dist-${{ github.run_number }} - path: ./dist + path: | + ./dist + ./js/*.tgz visual-regression-tests: runs-on: ubuntu-latest @@ -113,3 +118,44 @@ jobs: # virtualenv (which tox uses) dropped support for making python 3.7 environments in 20.27.0 toxdeps: virtualenv==20.26.6 hatchling - windows: py39-notebooks + + release: + needs: [tests, visual-regression-tests] + runs-on: ubuntu-20.04 + steps: + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: bqplot-image-gl-dist-${{ github.run_number }} + + - name: Install node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org" + + - name: Install Python + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install twine wheel jupyter-packaging jupyterlab + + - name: Publish the Python package + if: startsWith(github.event.ref, 'refs/tags/v') + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: twine upload --skip-existing dist/*.whl dist/*.tar.gz + + - name: Publish the NPM package + if: startsWith(github.event.ref, 'refs/tags/v') + run: | + echo $PRE_RELEASE + if [[ $PRE_RELEASE == "true" ]]; then export TAG="next"; else export TAG="latest"; fi + npm publish --tag ${TAG} --access public js/*.tgz + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + PRE_RELEASE: ${{ github.event.release.prerelease }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 9c38cc1..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Publish Package - -on: - push: - tags: - - '*' - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install node - uses: actions/setup-node@v2 - with: - node-version: '14.x' - registry-url: 'https://registry.npmjs.org' - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install twine wheel jupyter-packaging "jupyterlab<4" - - name: Publish the Python package - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: | - python setup.py sdist bdist_wheel - twine upload --skip-existing dist/* - - name: Publish the NPM package - run: | - cd js - npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}