|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: push |
| 4 | +# on: |
| 5 | + # push: |
| 6 | + # branches: 'master' |
| 7 | + # schedule: |
| 8 | + # - cron: '0 0 * * *' |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + |
| 13 | + runs-on: ubuntu-20.04 |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v2 |
| 18 | + - name: Install node |
| 19 | + uses: actions/setup-node@v1 |
| 20 | + with: |
| 21 | + node-version: '14.x' |
| 22 | + - name: Install Python |
| 23 | + uses: actions/setup-python@v2 |
| 24 | + with: |
| 25 | + python-version: '3.7' |
| 26 | + architecture: 'x64' |
| 27 | + |
| 28 | + - name: Setup pip cache |
| 29 | + uses: actions/cache@v2 |
| 30 | + with: |
| 31 | + path: ~/.cache/pip |
| 32 | + key: pip-3.7-${{ hashFiles('package.json') }} |
| 33 | + restore-keys: | |
| 34 | + pip-3.7- |
| 35 | + pip- |
| 36 | + - name: Get yarn cache directory path |
| 37 | + id: yarn-cache-dir-path |
| 38 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 39 | + - name: Setup yarn cache |
| 40 | + uses: actions/cache@v2 |
| 41 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 42 | + with: |
| 43 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 44 | + key: yarn-${{ hashFiles('**/yarn.lock') }} |
| 45 | + restore-keys: | |
| 46 | + yarn- |
| 47 | +
|
| 48 | + - name: Install dependencies |
| 49 | + run: | |
| 50 | + python -m pip install --upgrade pip |
| 51 | + pip install wheel twine setuptools packaging jupyterlab~=3.0 jupyter_packaging~=0.7.9 |
| 52 | + jlpm |
| 53 | + # python -m pip install -e .[dev] |
| 54 | +
|
| 55 | + - name: Create server extension # and pip install |
| 56 | + run: | |
| 57 | + jlpm run build:prod |
| 58 | + # jupyter labextension develop . --overwrite |
| 59 | + # pip install .[dev] && jupyter serverextension enable --py jupyterlab_s3_browser |
| 60 | +
|
| 61 | + - name: Package extension |
| 62 | + run: | |
| 63 | + python setup.py sdist bdist_wheel |
| 64 | +
|
| 65 | + - name: Publish a Python distribution to PyPI |
| 66 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 67 | + uses: pypa/gh-action-pypi-publish@master |
| 68 | + with: |
| 69 | + user: __token__ |
| 70 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 71 | + |
| 72 | + - name: Publish labextension NPM |
| 73 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 74 | + uses: JS-DevTools/npm-publish@v1 |
| 75 | + with: |
| 76 | + token: ${{ secrets.NPM_TOKEN }} |
0 commit comments