ci.yml: refactor workflow (#8927)

pull/1/head
Anton Yakutovich 2022-10-12 14:17:21 +04:00 committed by GitHub
parent eb38d1d75c
commit cf2f75591f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 19 deletions

View File

@ -12,15 +12,17 @@ jobs:
name: CI name: CI
steps: steps:
- name: Setup Python - uses: actions/checkout@v3
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Checkout - uses: actions/setup-python@v4
uses: actions/checkout@v3
with: with:
fetch-depth: 0 python-version: '3.10'
cache: 'pip'
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
- name: Set up PR environment - name: Set up PR environment
if: github.event.number != null if: github.event.number != null
@ -29,8 +31,8 @@ jobs:
- name: Install npm dependencies - name: Install npm dependencies
run: npm ci run: npm ci
- name: Install python dependencies - name: Install pip dependencies
run: python3 -m pip install -r requirements.txt run: pip install -r requirements.txt -r scripts/pdf/requirements.txt
- name: Test - name: Test
run: npm test run: npm test
@ -38,18 +40,10 @@ jobs:
- name: Build - name: Build
run: bash scripts/build.sh 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@v4
with:
python-version: '3.x'
- name: Build PDF - name: Build PDF
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main' if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
run: | working-directory: ./scripts/pdf
cd scripts/pdf/ run: python render.py ../../pages -c solarized-light
pip3 install -r requirements.txt
python3 render.py ../../pages -c solarized-light
- name: Deploy - name: Deploy
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main' if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'