ci.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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@v4
  11. with:
  12. fetch-depth: 0
  13. - uses: actions/setup-python@v4
  14. with:
  15. python-version: '3.10'
  16. cache: 'pip'
  17. - uses: actions/setup-node@v4
  18. with:
  19. node-version: 'lts/*'
  20. cache: 'npm'
  21. - name: Set up PR environment
  22. if: github.event.number != null
  23. run: echo "PULL_REQUEST_ID=${{ github.event.number }}" >> $GITHUB_ENV
  24. - name: Install npm dependencies
  25. run: npm ci
  26. - name: Install pip dependencies
  27. run: pip install -r requirements.txt -r scripts/pdf/requirements.txt
  28. - name: Test
  29. run: npm test
  30. - name: Build
  31. run: bash scripts/build.sh
  32. - name: Build PDF
  33. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  34. working-directory: ./scripts/pdf
  35. run: bash build-pdf.sh
  36. - name: Deploy
  37. if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
  38. run: bash scripts/deploy.sh
  39. env:
  40. DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}