name: CI on: ['push', 'pull_request'] permissions: contents: write # to upload assets to releases jobs: ci: runs-on: ubuntu-latest name: CI steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-python@v5 with: python-version: '3.12' cache: 'pip' - uses: actions/setup-node@v4 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 -r scripts/test-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: bash build-pdf.sh - name: Deploy if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main' run: bash scripts/deploy.sh env: DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}