34 lines
1.1 KiB
YAML
34 lines
1.1 KiB
YAML
name: Build and publish Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Derive registry host and image name
|
|
id: registry
|
|
run: |
|
|
host="$(printf '%s' "${{ gitea.server_url }}" | sed -E 's#^[a-zA-Z][a-zA-Z0-9+.-]*://##; s#/.*$##')"
|
|
image="$(printf '%s' "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')"
|
|
echo "host=${host}" >> "$GITHUB_OUTPUT"
|
|
echo "image=${image}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ steps.registry.outputs.host }}
|
|
username: ${{ gitea.repository_owner }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push image
|
|
run: |
|
|
docker build -t "${{ steps.registry.outputs.host }}/${{ steps.registry.outputs.image }}:latest" .
|
|
docker push "${{ steps.registry.outputs.host }}/${{ steps.registry.outputs.image }}:latest"
|