Merge pull request #183 from poddeck/dependabot/npm_and_yarn/vitejs/p… #600
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: CI | |
| on: | |
| push: | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| security-events: write | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| checkov: | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Checkov | |
| uses: bridgecrewio/checkov-action@v12 | |
| with: | |
| file: Dockerfile | |
| framework: dockerfile | |
| quiet: true | |
| build: | |
| needs: checkov | |
| if: always() && (github.ref == 'refs/heads/main' || github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/v')) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Build image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| tags: poddeck-panel:ci | |
| - name: Trivy image scan | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| image-ref: poddeck-panel:ci | |
| format: table | |
| exit-code: 1 | |
| severity: CRITICAL,HIGH | |
| - name: Log in to GHCR | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract version tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| id: version | |
| run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" | |
| - name: Push image to GHCR | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| docker tag poddeck-panel:ci ghcr.io/${{ github.repository }}:${{ steps.version.outputs.tag }} | |
| docker tag poddeck-panel:ci ghcr.io/${{ github.repository }}:latest | |
| docker push ghcr.io/${{ github.repository }}:${{ steps.version.outputs.tag }} | |
| docker push ghcr.io/${{ github.repository }}:latest |