Skip to content

Create Get-UpSnap-Keys.py #7

Create Get-UpSnap-Keys.py

Create Get-UpSnap-Keys.py #7

name: Build and Push to GHCR
on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
paths-ignore:
- '**.md'
- 'docker-compose*.yml'
- '.gitignore'
- 'LICENSE'
- '.github/**'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Commit Message
id: get_msg
run: |
MSG=$(git log -1 --pretty=format:'%s')
echo "COMMIT_MSG=$MSG" >> "$GITHUB_OUTPUT"
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=0.1.${{ github.run_number }}
labels: |
org.opencontainers.image.description=${{ steps.get_msg.outputs.COMMIT_MSG }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
# 1. Apply stickers to the images inside
labels: ${{ steps.meta.outputs.labels }}
# 2. Apply stickers to the outside box (Index)
annotations: ${{ steps.meta.outputs.labels }}
# 3. Simplify the build (Remove "in-toto" clutter)
provenance: false