Skip to content

Commit

Permalink
Fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
neerajprad committed Jan 29, 2025
1 parent 2d35c99 commit 0608cc2
Showing 1 changed file with 42 additions and 10 deletions.
52 changes: 42 additions & 10 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0608cc2

Please sign in to comment.