ci.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. name: CI
  2. on: ['push', 'pull_request']
  3. permissions:
  4. contents: read # to fetch code (actions/checkout)
  5. jobs:
  6. ci:
  7. runs-on: ubuntu-latest
  8. name: CI
  9. steps:
  10. - uses: actions/checkout@v3
  11. - uses: actions/setup-python@v4
  12. with:
  13. python-version: '3.10'
  14. cache: 'pip'
  15. - uses: actions/setup-node@v3
  16. with:
  17. node-version: 'lts/*'
  18. cache: 'npm'
  19. - name: Set up PR environment
  20. if: github.event.number != null
  21. run: echo "PULL_REQUEST_ID=${{ github.event.number }}" >> $GITHUB_ENV
  22. - name: Install npm dependencies
  23. run: npm ci
  24. - name: Install pip dependencies
  25. run: pip install -r requirements.txt -r scripts/pdf/requirements.txt
  26. - name: Test
  27. run: npm test
  28. - name: Build
  29. run: bash scripts/build.sh
  30. - name: Build PDF
  31. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  32. working-directory: ./scripts/pdf
  33. run: python render.py ../../pages -c solarized-light
  34. - name: Deploy
  35. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  36. run: bash scripts/deploy.sh
  37. env:
  38. DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}