add docker labels

This commit is contained in:
Thephaseless 2024-07-25 21:07:10 +00:00
parent 754252a979
commit a0b61c9251

View File

@ -7,11 +7,11 @@ name: Docker
on: on:
schedule: schedule:
- cron: '25 0 * * *' - cron: "25 0 * * *"
push: push:
branches: ["main"] branches: ["main"]
# Publish semver tags as releases. # Publish semver tags as releases.
tags: [ 'v*.*.*' ] tags: ["v*.*.*"]
pull_request: pull_request:
branches: ["main"] branches: ["main"]
@ -21,10 +21,8 @@ env:
# github.repository as <account>/<repo> # github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
@ -43,7 +41,7 @@ jobs:
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0 uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
with: with:
cosign-release: 'v2.2.4' cosign-release: "v2.2.4"
# Set up BuildKit Docker container builder to be able to build # Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache # multi-platform images and export cache
@ -67,6 +65,13 @@ jobs:
id: meta id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with: with:
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,enable=${{ github.event_name != 'pull_request' && github.ref_name == 'main' }}, value=latest
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR) # Build and push Docker image with Buildx (don't push on PR)