tldr/.github/workflows/ci.yml

56 lines
1.3 KiB
YAML

name: CI
on: ['push', 'pull_request']
jobs:
ci:
runs-on: ubuntu-latest
name: CI
steps:
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up PR environment
if: github.event.number != null
run: echo "PULL_REQUEST_ID=${{ github.event.number }}" >> $GITHUB_ENV
- name: Install npm dependencies
run: npm ci
- name: Install python dependencies
run: python3 -m pip install -r requirements.txt
- name: Test
run: npm test
- name: Build
run: bash scripts/build.sh
- name: Setup Python for PDF generation
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Build PDF
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
run: |
cd scripts/pdf/
pip3 install -r requirements.txt
python3 render.py ../../pages -c solarized-light
- name: Deploy
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
run: bash scripts/deploy.sh
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}