roboluke-tasks/.github/workflows/docker_publish.yml

59 lines
1.6 KiB
YAML
Raw Normal View History

name: Publish Docker Image
on:
2024-07-13 12:18:27 +02:00
workflow_call:
inputs:
release:
required: true
type: string
jobs:
publish:
name: Publish Docker image
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
2024-07-13 12:02:18 +02:00
with:
2024-07-13 12:18:27 +02:00
ref: ${{ inputs.release }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
2024-07-13 12:29:24 +02:00
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=semver,pattern=v{{version}}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
push: true
2024-07-13 12:10:21 +02:00
tags: |
ghcr.io/${{ github.repository }}:latest
2024-07-13 12:18:27 +02:00
ghcr.io/${{ github.repository }}:${{ inputs.release }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
2024-07-13 12:18:27 +02:00
subject-name: ghcr.io/${{ github.repository }}:${{ inputs.release }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true