name: Build on: push: branches: [main] pull_request: branches: '*' env: CACHE_EPOCH: 1 jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Install node uses: actions/setup-node@v2 with: node-version: '14.x' - uses: actions/setup-python@v2 with: python-version: '3.8' - name: Cache node modules uses: actions/cache@v2 id: cache-node-modules with: path: 'node_modules/' key: | ${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - name: Cache yarn packages uses: actions/cache@v2 id: cache-yarn-packages if: steps.cache-node-modules.outputs.cache-hit != 'true' with: path: '.yarn-packages' key: | ${{ env.CACHE_EPOCH }}-yarn-packages-${{ hashFiles('yarn.lock') }} restore-keys: | ${{ env.CACHE_EPOCH }}-yarn-packages- - name: Setup pip (pip) run: | pip install -U pip setuptools wheel - uses: actions/cache@v2 with: path: ~/.cache/pip key: | ${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }} restore-keys: | ${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip- - name: Setup pip (dependecies) run: | pip install -r requirements-docs.txt - name: Install if: steps.cache-node-modules.outputs.cache-hit != 'true' run: | doit setup:js - name: Build run: | doit build - name: Upload (dist) uses: actions/upload-artifact@v2 with: name: jupyterlite dist ${{ github.run_number }} path: ./dist - name: Lint run: | doit lint - name: Test run: | doit test - name: Docs run: | doit docs - name: Check Built Artifacts run: | doit check deploy: needs: [build] runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v2 with: name: jupyterlite dist ${{ github.run_number }} path: ./dist - name: Extract the app run: | tar -xvf ./dist/*.tgz - name: Deploy to Production id: prod run: | if [ "$REF" == 'refs/heads/main' ] then echo "::set-output name=vercel-args::--prod" else echo "::set-output name=vercel-args::" fi env: REF: ${{ github.ref }} - uses: amondnet/vercel-action@v20 with: github-token: ${{ secrets.GITHUB_TOKEN }} vercel-token: ${{ secrets.VERCEL_TOKEN }} vercel-org-id: ${{ secrets.VERCEL_ORG_ID}} vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}} vercel-args: ${{ steps.prod.outputs.vercel-args }} working-directory: ./package