initial commit
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
name: publish-client-image
|
||||
|
||||
# Builds the redapricot Go client into a container image with ko and pushes it
|
||||
# to the configured registry. Triggers on version tags and manual dispatch.
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Extra image tag to publish (in addition to the git ref)'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write # required only when KO_DOCKER_REPO is on ghcr.io
|
||||
|
||||
env:
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# EDIT ME — the image repository to publish to: <registry>/<namespace>/<name>
|
||||
# examples:
|
||||
# ghcr.io/your-org/redapricot-client
|
||||
# docker.io/youruser/redapricot-client
|
||||
# registry.example.com/team/redapricot-client
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
KO_DOCKER_REPO: REPLACE_ME_REGISTRY/redapricot-client
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: ko-build/setup-ko@v0.10
|
||||
|
||||
- name: Derive registry host and image tags
|
||||
id: meta
|
||||
run: |
|
||||
echo "registry=${KO_DOCKER_REPO%%/*}" >> "$GITHUB_OUTPUT"
|
||||
tags="${GITHUB_REF_NAME},sha-${GITHUB_SHA::7}"
|
||||
if [ -n "${{ github.event.inputs.tag }}" ]; then
|
||||
tags="${tags},${{ github.event.inputs.tag }}"
|
||||
fi
|
||||
echo "tags=${tags}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Authenticate to the registry.
|
||||
# • ghcr.io: setup-ko already logs in with the built-in GITHUB_TOKEN, so you
|
||||
# may delete this step.
|
||||
# • any other registry: set the REGISTRY_USERNAME / REGISTRY_PASSWORD repo
|
||||
# secrets; the host is derived from KO_DOCKER_REPO above.
|
||||
- name: Log in to the container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ steps.meta.outputs.registry }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push image with ko
|
||||
run: |
|
||||
ko build ./cmd/redapricot-client \
|
||||
--bare \
|
||||
--platform=linux/amd64,linux/arm64 \
|
||||
--tags "${{ steps.meta.outputs.tags }}"
|
||||
Reference in New Issue
Block a user