ci.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. - name: Setup Python
  11. uses: actions/setup-python@v4
  12. with:
  13. python-version: 3.8
  14. - name: Checkout
  15. uses: actions/checkout@v3
  16. with:
  17. fetch-depth: 0
  18. - name: Set up PR environment
  19. if: github.event.number != null
  20. run: echo "PULL_REQUEST_ID=${{ github.event.number }}" >> $GITHUB_ENV
  21. - name: Install npm dependencies
  22. run: npm ci
  23. - name: Install python dependencies
  24. run: python3 -m pip install -r requirements.txt
  25. - name: Test
  26. run: npm test
  27. - name: Build
  28. run: bash scripts/build.sh
  29. - name: Setup Python for PDF generation
  30. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  31. uses: actions/setup-python@v4
  32. with:
  33. python-version: '3.x'
  34. - name: Build PDF
  35. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  36. run: |
  37. cd scripts/pdf/
  38. pip3 install -r requirements.txt
  39. python3 render.py ../../pages -c solarized-light
  40. - name: Deploy
  41. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  42. run: bash scripts/deploy.sh
  43. env:
  44. DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}