Add Gitea Actions workflow to publish container image on tags
CI / test (pull_request) Successful in 22s
CI / test (pull_request) Successful in 22s
Build the root Dockerfile and push to gitea.kosmos.org/5apps/liquor-cabinet, tagged with the pushed git tag name.
This commit is contained in:
1 file changed
+32
@@ -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"
|
||||
Reference in new issue
Block a user