name: CI on: ['push', 'pull_request'] permissions: contents: read # to fetch code (actions/checkout) jobs: ci: runs-on: ubuntu-latest name: CI steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: '3.10' cache: 'pip' - uses: actions/setup-node@v3 with: node-version: 'lts/*' cache: 'npm' - name: Set up PR environment if: github.event.number != null run: echo "PULL_REQUEST_ID=${{ github.event.number }}" >> $GITHUB_ENV - name: Install npm dependencies run: npm ci - name: Install pip dependencies run: pip install -r requirements.txt -r scripts/pdf/requirements.txt - name: Test run: npm test - name: Build run: bash scripts/build.sh - name: Build PDF if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main' working-directory: ./scripts/pdf run: python render.py ../../pages -c solarized-light - name: Deploy if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main' run: bash scripts/deploy.sh env: DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}