name: Release on: push: tags: - '*' env: PIP_DISABLE_PIP_VERSION_CHECK: 1 defaults: run: shell: bash -l {0} jobs: integrity: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Build checksum file run: | sed -n 17,146p .github/workflows/build.yml > build sed -n 17,146p .github/workflows/release.yml > release diff build release test: needs: [integrity] runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Install node uses: actions/setup-node@v2 with: node-version: '14.x' - name: Install Python uses: actions/setup-python@v2 with: python-version: '3.9' architecture: 'x64' - name: Install dependencies run: | python -m pip install --upgrade pip wheel python -m pip install jupyter_packaging - name: Install the package run: | python -m pip install . jupyter labextension list 2>&1 | grep -ie "@jupyterlab-classic/lab-extension.*enabled.*ok" - jupyter server extension list 2>&1 | grep -ie "jupyterlab_classic.*enabled" - python -m jupyterlab.browser_check - name: Lint run: | jlpm jlpm run eslint:check jlpm run prettier:check - name: Test run: | jlpm run build:test jlpm run test build: needs: [integrity] runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Install node uses: actions/setup-node@v2 with: node-version: '14.x' - name: Install Python uses: actions/setup-python@v2 with: python-version: '3.9' architecture: 'x64' - name: Install dependencies run: | python -m pip install --upgrade pip wheel python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4" - name: Build pypi distributions run: | python setup.py sdist bdist_wheel - name: Build npm distributions run: | mkdir pkgs jlpm lerna exec -- npm pack cp packages/*/*.tgz pkgs - name: Build checksum file run: | cd dist sha256sum * | tee SHA256SUMS cd ../pkgs sha256sum * | tee SHA256SUMS - name: Upload distributions uses: actions/upload-artifact@v2 with: name: dist ${{ github.run_number }} path: ./dist - name: Upload distributions uses: actions/upload-artifact@v2 with: name: pkgs ${{ github.run_number }} path: ./pkgs install: runs-on: ${{ matrix.os }}-latest needs: [build] strategy: fail-fast: false matrix: os: [ubuntu, macos, windows] python: ['3.6', '3.9'] include: - python: '3.6' dist: 'jupyterlab-classic*.tar.gz' - python: '3.9' dist: 'jupyterlab_classic*.whl' - os: windows py_cmd: python - os: macos py_cmd: python3 - os: ubuntu py_cmd: python steps: - name: Install Python uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} architecture: 'x64' - uses: actions/download-artifact@v2 with: name: dist ${{ github.run_number }} path: ./dist - name: Install the prerequisites run: | ${{ matrix.py_cmd }} -m pip install pip wheel - name: Install the package run: | cd dist ${{ matrix.py_cmd }} -m pip install -vv ${{ matrix.dist }} - name: Validate environment run: | ${{ matrix.py_cmd }} -m pip freeze ${{ matrix.py_cmd }} -m pip check - name: Validate the install run: | jupyter labextension list jupyter labextension list 2>&1 | grep -ie "@jupyterlab-classic/lab-extension.*enabled.*ok" - jupyter server extension list jupyter server extension list 2>&1 | grep -ie "jupyterlab_classic.*enabled" - jupyter classic --version jupyter classic --help release: if: startsWith(github.ref, 'refs/tags/') needs: [install] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - uses: actions/download-artifact@v2 with: name: dist ${{ github.run_number }} path: ./dist - name: Cleanup dist run: | rm dist/SHA256SUMS - name: Publish a Python distribution to PyPI uses: pypa/gh-action-pypi-publish@master with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} - name: Install Python uses: actions/setup-python@v2 with: python-version: '3.9' architecture: 'x64' - name: Install dependencies run: | python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9 pip jlpm jlpm run build - uses: actions/download-artifact@v2 with: name: pkgs ${{ github.run_number }} path: ./pkgs - uses: actions/setup-node@v2 with: node-version: '14.x' registry-url: 'https://registry.npmjs.org' - name: Publish to npm env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: | jlpm config set registry https://registry.npmjs.org npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc cp ~/.npmrc .npmrc jlpm release:npm --dist ./pkgs - name: Get the current tag id: current_tag run: | tag=`git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1)` echo "::set-output name=tag::${tag}" - name: Get the previous tag id: previous_tag run: | tag=`git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1)` echo "::set-output name=tag::${tag}" - name: Generate Changelog env: CHANGELOG_GITHUB_TOKEN: ${{ secrets.CHANGELOG_GITHUB_TOKEN }} run: | docker run --rm -v "$(pwd)":/usr/local/src/your-app \ -e CHANGELOG_GITHUB_TOKEN=${CHANGELOG_GITHUB_TOKEN} \ ferrarimarco/github-changelog-generator \ github_changelog_generator -u jtpio -p jupyterlab-classic --usernames-as-github-logins --no-issues --no-unreleased \ --since-tag ${{ steps.previous_tag.outputs.tag }} --header "" --pr-label "## Changes" head -n -1 CHANGELOG.md > CHANGELOG - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: ${{ github.ref }} body_path: CHANGELOG # TODO: set to false? draft: true prerelease: ${{ contains(github.ref, 'a') || contains(github.ref, 'b') || contains(github.ref, 'rc') }}