Skip to content

chore(deps): Update dependency stylelint to v16.26.1 (#118) #324

chore(deps): Update dependency stylelint to v16.26.1 (#118)

chore(deps): Update dependency stylelint to v16.26.1 (#118) #324

Workflow file for this run

name: build-and-push
# Add concurrency control
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- "develop"
tags:
- "*"
paths-ignore:
- "README.md"
- "CONTRIBUTING.md"
- "renovate.json"
- ".github/ISSUE_TEMPLATE/**"
- "PULL_REQUEST_TEMPLATE.md"
- "docs/**"
pull_request:
branches:
- "develop"
paths-ignore:
- "README.md"
- "CONTRIBUTING.md"
- "renovate.json"
- ".github/ISSUE_TEMPLATE/**"
- "PULL_REQUEST_TEMPLATE.md"
- "docs/**"
jobs:
build-and-push-docker:
runs-on: ubuntu-latest
# Add timeout to prevent hung builds
timeout-minutes: 60
permissions:
contents: read
packages: write
security-events: write
id-token: write
env:
DOCKERHUB_REPO: thezak48/comps
REGISTRY: ghcr.io
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Improved caching strategy with versioning
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# Add vulnerability scanning
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: "ghcr.io/thezak48/comps:edge"
format: "sarif"
output: "trivy-results.sarif"
# Generate SBOM
- uses: anchore/sbom-action@v0
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/thezak48/comps
thezak48/comps
flavor: |
latest=${{ github.ref_type == 'tag' }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=edge,branch=develop
type=ref,event=pr
type=sha,format=long
type=sha
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_THEZAK48 }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: docker.io
- name: Docker build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event.pull_request.head.repo.full_name == 'thezak48/comps' || github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
provenance: true
sbom: true
build-args: |
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
VCS_REF=${{ github.sha }}
VERSION=${{ steps.meta.outputs.tags }}
# Upload security scan results
- name: Upload Trivy scan results
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"