Files
anchorhost-frontend/.gitea/workflows/docker.yml
T
wfalkowski 88736cd35d
Build and publish Docker image / build-and-publish (push) Failing after 15s
Fix Gitea Actions checkout reference
2026-10-19 17:51:26 +00:00

50 lines
1.4 KiB
YAML

name: Build and publish Docker image
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Log in to Gitea Container Registry
env:
REGISTRY_USER: ${{ gitea.actor }}
REGISTRY_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: printf '%s' "$REGISTRY_TOKEN" | docker login git.anchorhost.eu --username "$REGISTRY_USER" --password-stdin
- name: Build and tag image
env:
COMMIT_SHA: ${{ gitea.sha }}
run: |
image='git.anchorhost.eu/anchorhost.eu/anchorhost-frontend'
short_sha="$(printf '%.12s' "$COMMIT_SHA")"
docker build \
--label "org.opencontainers.image.revision=$COMMIT_SHA" \
--tag "$image:main-$short_sha" \
--tag "$image:main-latest" \
.
- name: Push image tags
env:
COMMIT_SHA: ${{ gitea.sha }}
run: |
image='git.anchorhost.eu/anchorhost.eu/anchorhost-frontend'
short_sha="$(printf '%.12s' "$COMMIT_SHA")"
docker push "$image:main-$short_sha"
docker push "$image:main-latest"
- name: Log out from Gitea Container Registry
if: always()
run: docker logout git.anchorhost.eu