Skip to content

📦 Publish Docker Images #23

📦 Publish Docker Images

📦 Publish Docker Images #23

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: ' 📦 Publish Docker Images'
on:
workflow_dispatch:
inputs:
dryRun:
description: 'Dry Run'
type: choice
options:
- 'yes'
- 'no'
default: 'yes'
required: false
ref:
description: 'Reference / tag to publish'
required: false
type: string
workflow_call:
inputs:
ref:
description: 'Reference / tag to publish'
required: true
type: string
env:
REGISTRY: ghcr.io
IMAGE_NAME: 'streetsidesoftware/cspell'
permissions:
contents: read
packages: write
jobs:
build-and-push-image:
runs-on: ubuntu-latest
env:
DEBUG: ${{ inputs.dryRun == 'yes'}}
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
ref: ${{ inputs.ref || github.ref }}
- name: CSpell Version
id: cspell-version
run: |
echo CSPELL_VERSION=$(jq -r ".dependencies.cspell | sub(\"[_^]\"; \"\")" package.json) >> "$GITHUB_OUTPUT"
- name: Log in to the Container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ steps.cspell-version.outputs.CSPELL_VERSION }}
labels: |
org.opencontainers.image.title=cspell
org.opencontainers.image.description=CSpell command line spell checker for code and other documents.
org.opencontainers.image.vendor=Street Side Software
- name: Log Docker metadata
env:
META: ${{ toJSON(steps.meta.outputs) }}
run: echo "$META"
- name: Build and push Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
if: ${{ env.DEBUG != 'true' }}
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Summary
uses: streetsidesoftware/actions/public/summary@v1
with:
text: |
## Published Docker Image 🚀
- **CSpell Library Version:** ${{ steps.cspell-version.outputs.CSPELL_VERSION }}
- **Docker Image:** ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- **Tags:** ${{ steps.meta.outputs.tags }}
- **Labels:** ${{ steps.meta.outputs.labels }}
- **ref:** ${{ inputs.ref }}
- **github.ref:** ${{ github.ref }}
- **Dry Run:** ${{ inputs.dryRun }}
- **Debug:** ${{ env.DEBUG }}
# cspell:ignore opencontainers