mirror of
https://github.com/run-llama/llama_extract.git
synced 2026-07-01 22:34:03 -04:00
Fix release script
This commit is contained in:
@@ -1,24 +1,56 @@
|
||||
name: Publish Release
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Unit Testing"]
|
||||
types:
|
||||
- completed
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
if: |
|
||||
github.repository == 'run-llama/llama_extract' &&
|
||||
(github.event_name == 'workflow_dispatch' ||
|
||||
(github.event_name == 'workflow_run' &&
|
||||
github.event.workflow_run.name == 'Unit Testing' &&
|
||||
github.event.workflow_run.conclusion == 'success'))
|
||||
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_testing.yml',
|
||||
ref: context.sha
|
||||
});
|
||||
|
||||
- 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_testing.yml',
|
||||
status: 'completed',
|
||||
head_sha: context.sha
|
||||
});
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user