mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
55 lines
2.4 KiB
YAML
55 lines
2.4 KiB
YAML
name: Release per-commit
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Cargo Build, Test, and Linting"]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
upload-artifacts:
|
|
if: success() && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'master'
|
|
name: Download & Upload Builds
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- create-draft-release
|
|
steps:
|
|
- name: Download all build artifacts
|
|
uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
// This script finds and downloads all artifacts from the triggering workflow run
|
|
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: ${{ github.event.workflow_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',
|
|
});
|
|
fs.writeFileSync(`${artifact.name}.zip`, Buffer.from(download.data));
|
|
// Unzip the downloaded file
|
|
// This is a simple example, you'd need to add more robust unzipping logic.
|
|
}
|
|
- name: Upload Linux executable to release
|
|
run: |
|
|
gh release upload ${{ needs.create-draft-release.outputs.release-id }} ./pumpkin-ubuntu-latest/pumpkin --repo ${NIGHTLY_REPO}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.COMMIT_REPO_TOKEN }}
|
|
NIGHTLY_REPO: ${{ github.repository_owner }}/pumpkin-commit-builds
|
|
- name: Upload Windows executable to release
|
|
run: |
|
|
gh release upload ${{ needs.create-draft-release.outputs.release-id }} ./pumpkin-windows-latest/pumpkin.exe --repo ${NIGHTLY_REPO}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.COMMIT_REPO_TOKEN }}
|
|
NIGHTLY_REPO: ${{ github.repository_owner }}/pumpkin-commit-builds
|
|
- name: Upload macOS executable to release
|
|
run: |
|
|
gh release upload ${{ needs.create-draft-release.outputs.release-id }} ./pumpkin-macos-latest/pumpkin --repo ${NIGHTLY_REPO}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.COMMIT_REPO_TOKEN }}
|
|
NIGHTLY_REPO: ${{ github.repository_owner }}/pumpkin-commit-builds |