2020-06-09 11:10:15 +01:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on: ['push', 'pull_request']
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
ci:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
steps:
|
2021-09-03 16:17:51 +01:00
|
|
|
- name: Setup Python
|
2022-05-01 08:50:24 +01:00
|
|
|
uses: actions/setup-python@v3
|
2021-09-03 16:17:51 +01:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
2020-06-09 11:10:15 +01:00
|
|
|
|
|
|
|
- name: Checkout
|
2022-05-01 08:50:24 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-05 16:23:08 +01:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2020-06-09 11:10:15 +01:00
|
|
|
|
2020-06-24 13:11:33 +01:00
|
|
|
- name: Set up PR environment
|
|
|
|
if: github.event.number != null
|
2020-11-18 11:54:26 +00:00
|
|
|
run: echo "PULL_REQUEST_ID=${{ github.event.number }}" >> $GITHUB_ENV
|
2020-06-24 13:11:33 +01:00
|
|
|
|
2020-06-09 11:10:15 +01:00
|
|
|
- name: Install npm dependencies
|
|
|
|
run: npm ci
|
|
|
|
|
2021-09-03 16:17:51 +01:00
|
|
|
- name: Install python dependencies
|
|
|
|
run: python3 -m pip install -r requirements.txt
|
|
|
|
|
2020-06-09 11:10:15 +01:00
|
|
|
- name: Test
|
|
|
|
run: npm test
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: bash scripts/build.sh
|
|
|
|
|
2020-11-27 09:27:13 +00:00
|
|
|
- name: Setup Python for PDF generation
|
2021-01-08 09:13:15 +00:00
|
|
|
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
|
2020-11-27 09:27:13 +00:00
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.x'
|
|
|
|
|
|
|
|
- name: Build PDF
|
2021-01-08 09:13:15 +00:00
|
|
|
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
|
2020-11-27 09:27:13 +00:00
|
|
|
run: |
|
|
|
|
cd scripts/pdf/
|
|
|
|
pip3 install -r requirements.txt
|
|
|
|
python3 render.py ../../pages -c solarized-light
|
|
|
|
|
2020-06-09 11:10:15 +01:00
|
|
|
- name: Deploy
|
2021-01-08 09:13:15 +00:00
|
|
|
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
|
2020-06-24 13:30:09 +01:00
|
|
|
run: bash scripts/deploy.sh
|
|
|
|
env:
|
|
|
|
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|