Update action.yml to use specific Docker image and refactor entrypoint.sh for improved argument handling; add GitHub Actions workflow for building and publishing container image.

This commit is contained in:
Luke Hagar
2025-09-11 16:47:41 +00:00
parent b0c7ffe677
commit e57f8c0d73
3 changed files with 76 additions and 15 deletions

58
.github/workflows/publish-image.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: Build and Publish Container Image
on:
push:
branches:
- main
tags:
- 'v*'
release:
types: [published]
workflow_dispatch: {}
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Derive image name (lowercase owner)
id: names
run: |
echo "OWNER_LC=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV
echo "IMAGE=${REGISTRY}/${GITHUB_REPOSITORY_OWNER,,}/slinky" >> $GITHUB_ENV
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=v1
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}