mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
Add release per commit workflow
This commit is contained in:
60
.github/workflows/release-per-commit.yml
vendored
Normal file
60
.github/workflows/release-per-commit.yml
vendored
Normal 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
|
||||
9
.github/workflows/rust.yml
vendored
9
.github/workflows/rust.yml
vendored
@@ -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
|
||||
Reference in New Issue
Block a user