Skip to content

Pre-release

Pre-release #48

Workflow file for this run

name: Pre-release
on:
workflow_run:
workflows: [Make Snapshot]
types: [completed]
branches: [develop]
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: 'Download artifact'
uses: actions/github-script@v6
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-windows"
})[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-windows.zip`, Buffer.from(download.data));
matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "megaglest-x64-ubuntu"
})[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-ubuntu.zip`, Buffer.from(download.data));
matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "megaglest-x64-macos"
})[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-macos.zip`, Buffer.from(download.data));
- name: 'Prepare artifacts'
run: |
unzip megaglest-x64-ubuntu.zip
unzip megaglest-x64-windows.zip
unzip megaglest-x64-macos.zip
rm megaglest-x64-windows.zip megaglest-x64-ubuntu.zip megaglest-x64-macos.zip
- name: 'Prerelease'
uses: ncipollo/release-action@v1
with:
artifacts: "*.tar.xz,*.zip,*.tar.bz2"
body: "MegaGlest Snapshot Release"
allowUpdates: true
prerelease: true
removeArtifacts: true
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