2020-06-09 11:10:15 +01:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on: ['push', 'pull_request']
|
|
|
|
|
2022-09-28 18:17:33 +01:00
|
|
|
permissions:
|
|
|
|
contents: read # to fetch code (actions/checkout)
|
|
|
|
|
2020-06-09 11:10:15 +01:00
|
|
|
jobs:
|
|
|
|
ci:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
steps:
|
2023-09-05 15:29:38 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-11-11 18:35:12 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-10-12 11:17:21 +01:00
|
|
|
|
2023-12-14 04:34:07 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2021-09-03 16:17:51 +01:00
|
|
|
with:
|
2023-12-14 04:34:07 +00:00
|
|
|
python-version: '3.12'
|
2022-10-12 11:17:21 +01:00
|
|
|
cache: 'pip'
|
2020-06-09 11:10:15 +01:00
|
|
|
|
2023-11-01 09:23:38 +00:00
|
|
|
- uses: actions/setup-node@v4
|
2020-10-05 16:23:08 +01:00
|
|
|
with:
|
2022-10-12 11:17:21 +01:00
|
|
|
node-version: 'lts/*'
|
|
|
|
cache: 'npm'
|
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
|
|
|
|
|
2022-10-12 11:17:21 +01:00
|
|
|
- name: Install pip dependencies
|
|
|
|
run: pip install -r requirements.txt -r scripts/pdf/requirements.txt
|
2021-09-03 16:17:51 +01:00
|
|
|
|
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: Build PDF
|
2021-01-08 09:13:15 +00:00
|
|
|
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
|
2022-10-12 11:17:21 +01:00
|
|
|
working-directory: ./scripts/pdf
|
2023-10-21 22:04:22 +01:00
|
|
|
run: bash build-pdf.sh
|
2020-11-27 09:27:13 +00:00
|
|
|
|
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 }}
|