1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/.github/workflows/ci.yml
dependabot[bot] 504b17dde1
build(deps): bump actions/setup-python from 5.5.0 to 5.6.0 (#16279)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.5.0 to 5.6.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](8d9ed9ac5c...a26af69be9)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: 5.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-28 15:42:09 +05:30

112 lines
3.8 KiB
YAML

name: CI
on: ['push', 'pull_request']
jobs:
ci:
name: CI
runs-on: ubuntu-latest
permissions:
contents: write # to upload assets to releases
attestations: write # to upload assets attestation for build provenance
id-token: write # grant additional permission to attestation action to mint the OIDC token permission
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
cache: 'pip'
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 'lts/*'
cache: 'npm'
- 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 pip dependencies
run: pip install -r requirements.txt -r scripts/pdf/requirements.txt -r scripts/test-requirements.txt
- name: Test
run: npm test
- name: Upload test logging
if: github.repository == 'tldr-pages/tldr' && github.event.pull_request.number != ''
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: debug.log
path: debug.log
- name: Build
run: bash scripts/build.sh
- name: Build PDF
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
working-directory: ./scripts/pdf
run: bash build-pdf.sh
- name: Deploy
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
run: bash scripts/deploy.sh
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for generated files
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
id: check-files
run: |
if [[ -n $(find language_archives -name "*.zip" -print -quit) ]]; then
echo "zip_exists=true" >> $GITHUB_ENV
else
echo "zip_exists=false" >> $GITHUB_ENV
fi
if [[ -n $(find scripts/pdf -name "*.pdf" -print -quit) ]]; then
echo "pdf_exists=true" >> $GITHUB_ENV
else
echo "pdf_exists=false" >> $GITHUB_ENV
fi
if [[ -f tldr.sha256sums ]]; then
echo "checksums_exist=true" >> $GITHUB_ENV
else
echo "checksums_exist=false" >> $GITHUB_ENV
fi
- name: Construct subject-path for attest
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
id: construct-subject-path
run: |
subject_path=""
if [[ ${{ env.zip_exists }} == 'true' ]]; then
zip_files=$(find language_archives -name '*.zip' -printf '%p,')
subject_path+="${zip_files::-1}"
fi
if [[ ${{ env.pdf_exists }} == 'true' ]]; then
if [[ -n $subject_path ]]; then subject_path+=","; fi
pdf_files=$(find scripts/pdf -name '*.pdf' -printf '%p,')
subject_path+="${pdf_files::-1}"
fi
if [[ ${{ env.checksums_exist }} == 'true' ]]; then
if [[ -n $subject_path ]]; then subject_path+=","; fi
subject_path+='tldr.sha256sums'
fi
echo "subject_path=$subject_path" >> $GITHUB_ENV
- name: Attest generated files
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/main'
id: attest
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
continue-on-error: true # prevent failing when no pages are modified
with:
subject-path: ${{ env.subject_path }}