[ci] Attempt to fix release workflow #99
Workflow file for this run
This file contains hidden or 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: Nightly Release | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
concurrency: | |
group: nightly-release-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
nightly-release: | |
name: Nightly Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get latest workflow run artifacts | |
id: download-artifacts | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs'); | |
const path = require('path'); | |
// Workflows to fetch artifacts from | |
const workflows = ['build.yml', 'static_analysis.yml']; | |
let allArtifacts = []; | |
for (const workflow of workflows) { | |
const runs = await github.rest.actions.listWorkflowRuns({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: workflow, | |
branch: 'main', | |
per_page: 1 | |
}); | |
if (!runs.data.workflow_runs.length) { | |
console.log(`No runs found for workflow ${workflow}`); | |
continue; | |
} | |
const runId = runs.data.workflow_runs[0].id; | |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: runId | |
}); | |
// ← Modified filter to exclude static analysis artifacts | |
const nightlyArtifacts = artifacts.data.artifacts.filter(a => | |
a.name.startsWith("Nightly_") && (a.name.endsWith(".zip") && a.name.endsWith(".tax.xz")) | |
); | |
if (nightlyArtifacts.length === 0) { | |
console.log(`No Nightly build artifacts found in workflow ${workflow}`); | |
continue; | |
} | |
allArtifacts.push(...nightlyArtifacts); | |
} | |
if (allArtifacts.length === 0) { | |
throw new Error("No Nightly build artifacts found in any workflow."); | |
} | |
for (const artifact of allArtifacts) { | |
const download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: artifact.id, | |
archive_format: 'zip' | |
}); | |
const filePath = path.join(process.env.GITHUB_WORKSPACE, `${artifact.name}.zip`); | |
fs.writeFileSync(filePath, Buffer.from(download.data)); | |
console.log(`Downloaded artifact: ${filePath}`); | |
} | |
- name: Unzip artifacts | |
run: | | |
mkdir -p archives | |
for f in *.zip; do | |
artifact_name="${f%.zip}" | |
mkdir -p "archives/$artifact_name" | |
unzip -o "$f" -d "archives/$artifact_name" | |
done | |
- name: Configure Git | |
run: | | |
git config user.name "github-actions" | |
git config user.email "github-actions@github.com" | |
- name: Create or update Nightly release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NOTES: | | |
Latest development release, continuously updated nightly. | |
run: | | |
# Delete existing Nightly release if it exists | |
output=$(gh release delete nightly -y 2>&1) || true | |
# Create new Nightly release with artifacts | |
gh release create nightly ./archives/* \ | |
--title "Nightly Release" \ | |
--notes "${{ env.NOTES }}" \ | |
--prerelease \ | |
--target ${{ github.sha }} |