Skip to content

Publish Release

Publish Release #10

name: Publish Release
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
actions: write # To trigger workflow
contents: read # To checkout code
if: github.repository == 'run-llama/llama_extract'
steps:
- name: Trigger Unit Tests
uses: actions/github-script@v7
with:
script: |
const result = await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'unit_test.yml',
ref: 'main'
});
- name: Wait for tests
uses: actions/github-script@v7
with:
script: |
const TIMEOUT = 600000; // 10 minutes in milliseconds
console.log('Waiting for tests to complete...');
await new Promise(r => setTimeout(r, TIMEOUT));
const runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'unit_test.yml',
status: 'completed',
branch: 'main'
});
if(runs.data.workflow_runs.length > 0) {
const run = runs.data.workflow_runs[0];
if(run.conclusion === 'success') {
console.log('Tests passed!');
} else {
throw new Error('Tests failed!');
}
} else {
throw new Error('Tests did not complete within 10 minutes');
}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Build package
run: poetry build
- name: Publish to PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.LLAMA_EXTRACT_PYPI_TOKEN }}