Skip to content

Release

Release #32

Workflow file for this run

name: Release
on:
workflow_run:
workflows:
- Build Code
branches:
- main
types:
- completed
jobs:
nightly-release:
name: Nightly Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
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 matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("nightly_");
});
let fs = require('fs');
for (const artifact of matchArtifacts) {
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/`+artifact.name+`.zip`, Buffer.from(download.data));
}
- name: Unzip files
shell: bash
run: |
mkdir archives
unzip '*.zip' -d archives
- name: Prepare Release
run: |
git config user.name github-actions
git config user.email [email protected]
git tag nightly
git push -f origin tag nightly
- name: Release
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTES: |
Latest development release, ready to install.
This release tag is continuously updated.
run: |
output=$(gh release delete nightly -y 2>&1) || [[ "${output}" == "release not found" ]]
gh release create nightly ./archives/* --title "Nightly Release" --notes "${{ env.NOTES }}" --prerelease --target ${{ github.sha }}