Skip to content

ci: update permissions #3

ci: update permissions

ci: update permissions #3

Workflow file for this run

name: CI
on:
push:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
PLATFORM: linux/amd64,linux/arm64
jobs:
build:
name: Build Php ${{ matrix.php_version }} container
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
php_version:
- 8.2
- 8.3
- 8.4
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ env.PLATFORM }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: actions/checkout@v4
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.title="php-devcontainer"
org.opencontainers.image.vendor="act coding GbR"
org.opencontainers.image.version="${{ matrix.php_version }}"
tags: |
type=raw,${{ matrix.php_version }}
flavor: |
latest=false
- name: Build and push
uses: docker/build-push-action@v6
id: push
with:
context: src
file: src/Dockerfile
tags: ${{ env.REGISTRY }}/${{ github.repository }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ env.PLATFORM }}
build-args: |
PHP_VERSION=${{ matrix.php_version }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
if: github.event_name != 'pull_request'
with:
subject-name: ${{ env.REGISTRY }}/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true