build(deps): bump bytes from 1.11.0 to 1.11.1 (#31) #154
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| env: | |
| RUST_BACKTRACE: 1 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| outputs: | |
| artifact-id: ${{ steps.upload.outputs.artifact-id }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: cargo build | |
| - uses: actions/upload-artifact@v4 | |
| id: upload | |
| with: | |
| name: komorebi-switcher-windows-pr-${{ github.event.number }}-${{ github.event.pull_request.head.sha }} | |
| path: target/debug/komorebi-switcher.exe | |
| overwrite: true | |
| build-macos: | |
| runs-on: macos-latest | |
| outputs: | |
| artifact-id: ${{ steps.upload.outputs.artifact-id }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: cargo build | |
| - uses: actions/upload-artifact@v4 | |
| id: upload | |
| with: | |
| name: komorebi-switcher-macos-pr-${{ github.event.number }}-${{ github.event.pull_request.head.sha }} | |
| path: target/debug/komorebi-switcher | |
| overwrite: true | |
| post-comment: | |
| needs: [build-windows, build-macos] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/github-script@v7 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| script: | | |
| // Build comment components | |
| const commitSha = '${{ github.event.pull_request.head.sha }}'; | |
| const prNumber = '${{ github.event.number }}'; | |
| const repository = '${{ github.repository }}'; | |
| const runId = '${{ github.run_id }}'; | |
| const windowsArtifactId = '${{ needs.build-windows.outputs.artifact-id }}'; | |
| const windowsArtifactName = `komorebi-switcher-windows-pr-${prNumber}-${commitSha}.zip`; | |
| const windowsdownloadUrl = `https://github.com/${repository}/actions/runs/${runId}/artifacts/${windowsArtifactId}`; | |
| const windowsLink = `- Windows: [${windowsArtifactName}](${windowsdownloadUrl})`; | |
| const macosArtifactId = '${{ needs.build-macos.outputs.artifact-id }}'; | |
| const macosArtifactName = `komorebi-switcher-macos-pr-${prNumber}-${commitSha}.zip`; | |
| const macosdownloadUrl = `https://github.com/${repository}/actions/runs/${runId}/artifacts/${macosArtifactId}`; | |
| const macosLink = `- macOS: [${macosArtifactName}](${macosdownloadUrl})`; | |
| const commentBody = "🎉 Build successful!" + "\n" + windowsLink + "\n" + macosLink; | |
| // Check for existing comment from this bot | |
| const comments = await github.rest.issues.listComments({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo | |
| }); | |
| const botComment = comments.data.find(comment => | |
| comment.user.login === 'github-actions[bot]' && | |
| comment.body.includes('🎉 Build successful!') | |
| ); | |
| if (botComment) { | |
| // Update existing comment | |
| await github.rest.issues.updateComment({ | |
| comment_id: botComment.id, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: commentBody | |
| }); | |
| } else { | |
| // Create new comment | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: commentBody | |
| }); | |
| } |