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