Make Snapshot #108
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: Make Snapshot | |
concurrency: | |
group: snapshot-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_run: | |
workflows: [CMake] | |
types: [completed] | |
branches: [develop] | |
# The artifact only runs on the same distro upon which it was built. | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: 'Download artifact' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: context.payload.workflow_run.id, | |
}); | |
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | |
return artifact.name == "megaglest-x64-macos" | |
})[0]; | |
let download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: matchArtifact.id, | |
archive_format: 'zip', | |
}); | |
let fs = require('fs'); | |
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/megaglest-x64-macos.zip`, Buffer.from(download.data)); | |
matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | |
return artifact.name == "megaglest-x64-windows-archive" | |
})[0]; | |
download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: matchArtifact.id, | |
archive_format: 'zip', | |
}); | |
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/megaglest-x64-windows-archive.zip`, Buffer.from(download.data)); | |
- name: 'Prepare artifacts' | |
run: | | |
unzip megaglest-x64-windows-archive.zip | |
unzip megaglest-x64-macos.zip | |
rm megaglest-x64-windows-archive.zip megaglest-x64-macos.zip | |
- name: 'Prerelease' | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "*.zip,*.tar.bz2" | |
body: "MegaGlest Snapshot Release" | |
allowUpdates: true | |
prerelease: true | |
removeArtifacts: false | |
replacesArtifacts: true | |
omitBodyDuringUpdate: true | |
omitNameDuringUpdate: true | |
tag: snapshot | |
on-failure: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | |
steps: | |
- run: | | |
echo 'The triggering workflow failed' | |
exit 1 |