Skip to content

ci: add token permissions #55

ci: add token permissions

ci: add token permissions #55

Workflow file for this run

name: "Build container image"
on:
push:
branches:
- main
tags:
- "*"
workflow_dispatch:
env:
DOCKER_IMAGE: ghcr.io/octoprint/custopizer
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: "⬇ Checkout"
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: "🐳 Set up Docker Buildx"
uses: docker/setup-buildx-action@v3
- name: "🐳 Login to GHCR"
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "🏗 Build"
id: docker_build
uses: docker/build-push-action@v6
with:
context: ./src
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}