Tutoriel S3 SSP Cloud #125
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Pull request: deploy to preview website (Netlify) and test notebooks" | |
on: | |
pull_request: | |
branches: | |
- main | |
- master | |
jobs: | |
pages: | |
name: "Preview on Netlify" | |
runs-on: ubuntu-latest | |
container: linogaliana/python-datascientist:latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Configure safe.directory # Workaround for actions/checkout#760 | |
run: git config --global --add safe.directory /__w/python-datascientist/python-datascientist | |
- name: Render website | |
run: | | |
quarto --version | |
quarto render --to html --profile fr | |
quarto render --to html --profile en | |
- name: Install npm | |
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Deploy to Netlify | |
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
# NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID added in the repo's secrets | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
BRANCHE_REF: ${{ github.event.pull_request.head.ref }} | |
run: | | |
npm init -y | |
npm install --unsafe-perm=true netlify-cli -g | |
netlify init | |
netlify deploy --alias=${BRANCHE_REF} --dir="_site" --message "Preview deploy from ${BRANCHE_REF}" | |
enonces: | |
name: Render notebooks | |
runs-on: ubuntu-latest | |
container: linogaliana/python-datascientist:latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Configure safe.directory # Workaround for actions/checkout#760 | |
run: | | |
git config --global --add safe.directory /__w/python-datascientist/python-datascientist | |
git config --global --add safe.directory /__w/python-datascientist/python-datascientist-notebooks | |
- shell: bash | |
run: | | |
ls | |
conda info | |
conda list | |
- name: Convert in ipynb with Quarto | |
run: | | |
quarto --version | |
quarto render content --to ipynb --profile fr | |
quarto render content --to ipynb --profile en | |
mkdir -p temp_notebooks | |
mkdir -p temp_notebooks/notebooks | |
python build/move_files.py --direction temp_notebooks/notebooks | |
quarto render content --to ipynb --execute -M echo:true --profile fr | |
quarto render content --to ipynb --execute -M echo:true --profile en | |
mkdir -p temp_notebooks/corrections | |
python build/move_files.py --direction temp_notebooks/corrections | |
- name: Pushes to another repository | |
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
uses: linogaliana/github-action-push-to-another-repository@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source-directory: 'temp_notebooks/' | |
destination-repository-username: 'linogaliana' | |
destination-repository-name: 'python-datascientist-notebooks' | |
user-email: [email protected] | |
destination-github-username: linogaliana | |
target-branch: dev | |
create-target-branch-if-needed: true | |
reset-repo: true | |
define-matrix: | |
runs-on: ubuntu-latest | |
needs: enonces | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'linogaliana/python-datascientist-notebooks' | |
ref: dev | |
- name: Define matrix | |
id: set-matrix | |
run: | | |
echo "::set-output name=matrix::$(find . -type f -name "*.ipynb" ! -name "_*" | jq -R -s -c 'split("\n")[:-1]')" | |
check: | |
needs: define-matrix | |
runs-on: ubuntu-latest | |
container: linogaliana/python-datascientist:latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
manifest: ${{ fromJson(needs.define-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'linogaliana/python-datascientist-notebooks' | |
- run: | | |
quarto render ${{ matrix.manifest }} --execute |