Update release #2
Workflow file for this run
This file contains 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: Ceylon-Build-Python | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- devops | |
- release | |
tags: | |
- '*' | |
jobs: | |
release: | |
name: Ceylon-Release-Python | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get latest successful workflow run | |
id: get_latest_run | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const workflow_id = 'python-build.yml'; // Replace with your workflow file name | |
const { data: runs } = await github.rest.actions.listWorkflowRuns({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: workflow_id, | |
status: 'success', | |
branch: context.ref, | |
}); | |
if (runs.workflow_runs.length === 0) { | |
core.setFailed('No successful workflow runs found'); | |
return; | |
} | |
const latestRun = runs.workflow_runs[0]; | |
console.log(`Latest successful run ID: ${latestRun.id}`); | |
core.setOutput('run_id', latestRun.id); | |
- name: Download artifacts | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const run_id = ${{ steps.get_latest_run.outputs.run_id }}; | |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: run_id, | |
}); | |
for (const artifact of artifacts.data.artifacts) { | |
const download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: artifact.id, | |
archive_format: 'zip', | |
}); | |
const fs = require('fs'); | |
fs.writeFileSync('${{github.workspace}}/' + artifact.name + '.zip', Buffer.from(download.data)); | |
} | |
- name: Unzip artifacts | |
run: | | |
for file in *.zip | |
do | |
unzip "$file" -d "${file%.zip}" | |
done | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
with: | |
command: upload | |
args: --non-interactive --skip-existing wheels-*/* |