Add release per commit workflow

This commit is contained in:
Alexander Medvedev 2025-08-12 12:57:05 +02:00
parent 40fb8ec481
commit 6a1cd304d7
2 changed files with 64 additions and 5 deletions

View File

@ -0,0 +1,60 @@
# In your .github/workflows/release-per-commit.yml file
name: Release per-commit
on:
workflow_run:
workflows: ["Cargo Build, Test, and Linting"]
types:
- completed
jobs:
# The rest of your jobs would go here
# ...
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

View File

@ -38,7 +38,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: toolchain:
- stable - stable
steps: steps:
@ -51,12 +51,11 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: toolchain:
- stable - stable
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo build --verbose --release - run: cargo build --verbose --release
@ -65,7 +64,7 @@ jobs:
with: with:
name: pumpkin-${{ matrix.os }} name: pumpkin-${{ matrix.os }}
compression-level: 9 compression-level: 9
path: target/${{ matrix.target }}/release/pumpkin* path: target/release/pumpkin*
clippy_release: clippy_release:
name: Run lints in release mode name: Run lints in release mode
runs-on: ubuntu-latest runs-on: ubuntu-latest