WIP: Publish container image to Gitea registry on tag pushes #15

Draft
raucao wants to merge 1 commits from ci/container-build-on-tags into master
pull from: ci/container-build-on-tags
+32
View File
@@ -0,0 +1,32 @@
name: Publish container image
on:
push:
tags: ["*"]
env:
REGISTRY: gitea.kosmos.org
IMAGE: gitea.kosmos.org/5apps/liquor-cabinet
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: builtin:checkout
# The automatic job token (GITEA_TOKEN / secrets.GITHUB_TOKEN) cannot
# publish to Gitea's package registry, so use a personal access token
# (with package write access) supplied via repository/org secrets.
- name: Log in to the container registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" \
--username "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
- name: Build and push
run: |
set -e
# Git tag names can contain characters that are invalid in Docker
# tags (e.g. "/"), so sanitize the ref-derived tag.
tag="$(echo "$GITHUB_REF_NAME" | tr '/' '-')"
docker build -t "$IMAGE:$tag" .
docker push "$IMAGE:$tag"