Skip to content

add llama3 in qa notebook (#1947) #140

add llama3 in qa notebook (#1947)

add llama3 in qa notebook (#1947) #140

name: Deploy to GitHub Pages, Update notebooks index
on:
push:
branches:
- 'main'
- 'latest'
workflow_dispatch:
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build_assets:
runs-on: ubuntu-20.04
permissions:
contents: write
outputs:
should_deploy: ${{ steps.check_deploy.outputs.should_deploy }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
token: ${{ secrets.GH_ACTIONS_BOT_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Node.js dependencies
working-directory: ./selector
shell: bash
run: npm ci
- name: Validate all notebooks metadata
uses: actions/github-script@v7
with:
script: |
const { NotebookMetadataHandler } = await import('${{ github.workspace }}/selector/src/notebook-metadata/notebook-metadata-handler.js');
const [error, metadataMarkdowns] = NotebookMetadataHandler.validateAll();
core.summary.addHeading(`Validated Notebooks (${metadataMarkdowns.length})`, '2');
core.summary.addRaw(metadataMarkdowns.join('\n\n'));
core.summary.write();
if (error) {
core.setFailed(error);
}
- name: Build static for GitHub Pages
working-directory: ./selector
shell: bash
run: npm run build
- name: Check if deploy needed
id: check_deploy
uses: actions/github-script@v7
with:
script: |
const { readFile } = require('fs/promises');
const { checksumFileName } = await import('${{ github.workspace }}/selector/src/shared/build-checksum.js');
const { owner, repo } = context.repo;
const { data: { html_url }} = await github.rest.repos.getPages({ owner, repo });
const deployedChecksum = await fetch(`${html_url}/${checksumFileName}`).then((res) => res.status === 200 ? res.text() : null);
const currentChecksum = await readFile(`${{ github.workspace }}/selector/dist/openvino_notebooks/${checksumFileName}`, { encoding: 'utf8'});
const isManualDeploy = context.eventName === 'workflow_dispatch';
const shouldDeploy = isManualDeploy || currentChecksum !== deployedChecksum;
core.setOutput('should_deploy', shouldDeploy);
- name: Upload pages artifact
if: ${{ steps.check_deploy.outputs.should_deploy == 'true' }}
uses: actions/upload-pages-artifact@v3
with:
path: ./selector/dist/openvino_notebooks
- name: Generate new notebooks index
if: ${{ steps.check_deploy.outputs.should_deploy == 'true' }}
uses: actions/github-script@v7
with:
script: |
const { generateNotebooksIndex } = await import('${{ github.workspace }}/selector/src/shared/generate-notebooks-index.js');
generateNotebooksIndex(`${{ github.workspace }}/selector/dist/openvino_notebooks/notebooks-metadata-map.json`);
- name: Commit notebooks index
if: ${{ steps.check_deploy.outputs.should_deploy == 'true' }}
shell: bash
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add ./notebooks/README.md
git commit -m "Update notebooks index readme file [skip ci]" || echo "Index file is not changed"
git push
deploy_github_pages:
runs-on: ubuntu-20.04
needs: build_assets
if: ${{ needs.build_assets.outputs.should_deploy == 'true' }}
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4