ci.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: CI
  2. on: ['push', 'pull_request']
  3. jobs:
  4. ci:
  5. runs-on: ubuntu-latest
  6. name: CI
  7. steps:
  8. - name: Setup Python
  9. uses: actions/setup-python@v2
  10. with:
  11. python-version: 3.8
  12. - name: Checkout
  13. uses: actions/checkout@v2
  14. with:
  15. fetch-depth: 0
  16. - name: Set up PR environment
  17. if: github.event.number != null
  18. run: echo "PULL_REQUEST_ID=${{ github.event.number }}" >> $GITHUB_ENV
  19. - name: Install npm dependencies
  20. run: npm ci
  21. - name: Install python dependencies
  22. run: python3 -m pip install -r requirements.txt
  23. - name: Test
  24. run: npm test
  25. - name: Build
  26. run: bash scripts/build.sh
  27. - name: Setup Python for PDF generation
  28. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  29. uses: actions/setup-python@v2
  30. with:
  31. python-version: '3.x'
  32. - name: Build PDF
  33. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  34. run: |
  35. cd scripts/pdf/
  36. pip3 install -r requirements.txt
  37. python3 render.py ../../pages -c solarized-light
  38. - name: Deploy
  39. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  40. run: bash scripts/deploy.sh
  41. env:
  42. DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}