chore(deps): bump oven/bun from 1.3.14-alpine to 1.4.0-alpine #436
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: PR Docker Build & Push | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: [main] | |
| permissions: | |
| packages: write | |
| pull-requests: write | |
| issues: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAMESPACE: ghcr.io/${{ github.repository_owner }} | |
| jobs: | |
| lint: | |
| name: Lint (bun lint / Biome) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Run lint | |
| run: bun run lint | |
| test: | |
| name: Test (bun test) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Run tests | |
| run: bun test | |
| typecheck: | |
| name: Typecheck (tsc --noEmit) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build database package | |
| run: bun run build:database | |
| - name: Typecheck nextjs-app | |
| run: bun run typecheck:nextjs | |
| - name: Typecheck job-server | |
| run: bun run typecheck:job-server | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| part: | |
| - streamystats-nextjs | |
| - streamystats-job-server | |
| include: | |
| - part: streamystats-nextjs | |
| folder: . | |
| dockerfile: apps/nextjs-app/Dockerfile | |
| - part: streamystats-job-server | |
| folder: . | |
| dockerfile: apps/job-server/Dockerfile | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract PR number | |
| id: pr | |
| run: echo "number=${{ github.event.number }}" >> $GITHUB_OUTPUT | |
| - name: Build and push ${{ matrix.part }} | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: ${{ matrix.folder }} | |
| file: ${{ matrix.dockerfile }} | |
| platforms: linux/amd64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| VERSION=pr-${{ steps.pr.outputs.number }} | |
| COMMIT_SHA=${{ github.sha }} | |
| BUILD_TIME=${{ github.event.pull_request.updated_at }} | |
| push: true | |
| tags: | | |
| ${{ env.IMAGE_NAMESPACE }}/${{ matrix.part }}:pr-${{ steps.pr.outputs.number }} | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@v0.36.0 | |
| with: | |
| image-ref: ${{ env.IMAGE_NAMESPACE }}/${{ matrix.part }}:pr-${{ steps.pr.outputs.number }} | |
| format: table | |
| exit-code: "0" | |
| severity: CRITICAL,HIGH | |
| ignore-unfixed: true | |
| summary: | |
| runs-on: ubuntu-latest | |
| needs: [lint, test, typecheck, build-and-push] | |
| if: always() | |
| steps: | |
| - name: PR Build Summary | |
| run: | | |
| echo "## 🚀 PR Docker Build Complete" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**PR Number:** \`#${{ github.event.number }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**PR Title:** \`${{ github.event.pull_request.title }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**Tag:** \`pr-${{ github.event.number }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**Registry:** \`${{ env.REGISTRY }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**Namespace:** \`${{ env.IMAGE_NAMESPACE }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**Commit SHA:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Built Images:" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`${{ env.IMAGE_NAMESPACE }}/streamystats-nextjs:pr-${{ github.event.number }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`${{ env.IMAGE_NAMESPACE }}/streamystats-job-server:pr-${{ github.event.number }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Usage:" >> $GITHUB_STEP_SUMMARY | |
| echo "To test this PR, update your \`docker-compose.yml\` with:" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY | |
| echo "export VERSION=pr-${{ github.event.number }}" >> $GITHUB_STEP_SUMMARY | |
| echo "docker-compose up -d" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| - name: Add PR comment | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const prNumber = context.payload.number; | |
| const namespace = process.env.IMAGE_NAMESPACE; | |
| const comment = `## 🐳 PR Docker Images Built | |
| Your PR has been built and pushed to GHCR with the tag \`pr-${prNumber}\`. | |
| ### Available Images: | |
| - \`${namespace}/streamystats-nextjs:pr-${prNumber}\` | |
| - \`${namespace}/streamystats-job-server:pr-${prNumber}\` | |
| ### Usage: | |
| \`\`\`bash | |
| export VERSION=pr-${prNumber} | |
| docker-compose up -d | |
| \`\`\` | |
| **Note:** These images will be overwritten with each new push to this PR.`; | |
| // Check if we already have a comment from this workflow | |
| const comments = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| }); | |
| const existingComment = comments.data.find(comment => | |
| comment.user.login === 'github-actions[bot]' && | |
| comment.body.includes('🐳 PR Docker Images Built') | |
| ); | |
| if (existingComment) { | |
| // Update existing comment | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existingComment.id, | |
| body: comment | |
| }); | |
| } else { | |
| // Create new comment | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body: comment | |
| }); | |
| } |