From cf2f75591f3e2f18d6db3b9dcdb92456fe79bf8b Mon Sep 17 00:00:00 2001 From: Anton Yakutovich Date: Wed, 12 Oct 2022 14:17:21 +0400 Subject: [PATCH] ci.yml: refactor workflow (#8927) --- .github/workflows/ci.yml | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cce3e670..fe2b55ba4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,15 +12,17 @@ jobs: name: CI steps: - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 + - uses: actions/checkout@v3 - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 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 if: github.event.number != null @@ -29,8 +31,8 @@ jobs: - name: Install npm dependencies run: npm ci - - name: Install python dependencies - run: python3 -m pip install -r requirements.txt + - name: Install pip dependencies + run: pip install -r requirements.txt -r scripts/pdf/requirements.txt - name: Test run: npm test @@ -38,18 +40,10 @@ jobs: - 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@v4 - 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 + working-directory: ./scripts/pdf + run: python render.py ../../pages -c solarized-light - name: Deploy if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'