From 6a1cd304d7d22c6c6dfd901830f1dc2ee439db42 Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Tue, 12 Aug 2025 12:57:05 +0200 Subject: [PATCH] Add release per commit workflow --- .github/workflows/release-per-commit.yml | 60 ++++++++++++++++++++++++ .github/workflows/rust.yml | 9 ++-- 2 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release-per-commit.yml diff --git a/.github/workflows/release-per-commit.yml b/.github/workflows/release-per-commit.yml new file mode 100644 index 000000000..c4a0907ed --- /dev/null +++ b/.github/workflows/release-per-commit.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8b04e1105..caf05ce43 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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 \ No newline at end of file