ci.yml 1.1 KB

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