2023-10-18 15:23:09 +00:00
|
|
|
on:
|
2023-10-21 17:39:28 +00:00
|
|
|
workflow_run:
|
|
|
|
workflows: [build]
|
|
|
|
types:
|
|
|
|
- completed
|
2023-10-18 15:23:09 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
2023-10-21 17:39:28 +00:00
|
|
|
name: Release
|
|
|
|
# We run the release job only if a tag starts with 'v' letter
|
|
|
|
if: startsWith( github.ref, 'refs/tags/v' )
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout Git repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
# Download all artifacts in zip format
|
|
|
|
# https://github.com/actions/download-artifact/issues/143
|
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/github-script@v6
|
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
2023-10-21 17:23:31 +00:00
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
2023-10-21 17:39:28 +00:00
|
|
|
run_id: context.payload.workflow_run.id,
|
2023-10-21 17:23:31 +00:00
|
|
|
});
|
2023-10-21 17:39:28 +00:00
|
|
|
for (const artifact of allArtifacts.data.artifacts)
|
|
|
|
{
|
|
|
|
let download = await github.rest.actions.downloadArtifact({
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
artifact_id: artifact.id,
|
|
|
|
archive_format: 'zip',
|
|
|
|
});
|
|
|
|
|
|
|
|
let fs = require('fs');
|
|
|
|
fs.mkdirSync('artifacts');
|
|
|
|
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/artifacts/${artifact.name}.zip`, Buffer.from(download.data));
|
|
|
|
}
|
|
|
|
|
|
|
|
- name: list artifacts
|
|
|
|
run: find artifacts/
|
|
|
|
|
|
|
|
- uses: "marvinpinto/action-automatic-releases@latest"
|
|
|
|
with:
|
|
|
|
repo_token: "${{ secrets.RELEASE_TOKEN }}"
|
|
|
|
prerelease: true
|
|
|
|
files: |
|
|
|
|
artifacts/*
|