Some checks failed
Build and Push Container Image / build-and-push (push) Failing after 7s
43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
name: Build and Push Container Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: orchestration-platform
|
|
container:
|
|
image: docker:latest
|
|
options: -v /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
steps:
|
|
- name: Install git
|
|
run: apk add --no-cache git
|
|
|
|
- name: Checkout code
|
|
run: |
|
|
git clone --branch "${GITHUB_REF_NAME}" "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" .
|
|
|
|
- name: Determine image tag
|
|
id: meta
|
|
run: |
|
|
if echo "${{ gitea.ref }}" | grep -q "refs/tags/"; then
|
|
TAG=$(echo "${{ gitea.ref }}" | sed 's|refs/tags/||')
|
|
else
|
|
TAG="latest"
|
|
fi
|
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Login to Gitea registry
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ gitea.server_url }} -u ${{ gitea.actor }} --password-stdin
|
|
|
|
- name: Build and push image
|
|
run: |
|
|
IMAGE="${{ gitea.server_url }}/${{ gitea.repository }}:${{ steps.meta.outputs.tag }}"
|
|
docker build -t "${IMAGE}" .
|
|
docker push "${IMAGE}" |