43 lines
No EOL
1.6 KiB
YAML
43 lines
No EOL
1.6 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
tags: [v*]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: codeberg-small
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to Codeberg Container Registry
|
|
run: |
|
|
echo "${{ secrets.CODEBERG_TOKEN }}" | podman login --username "${{ secrets.CODEBERG_USERNAME }}" --password-stdin codeberg.org
|
|
|
|
- name: Extract version
|
|
id: version
|
|
run: |
|
|
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "major_minor=$(echo $VERSION | cut -d. -f1-2)" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "version=latest" >> $GITHUB_OUTPUT
|
|
echo "major_minor=latest" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Build and push Docker image
|
|
run: |
|
|
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
|
podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:${{ steps.version.outputs.version }} .
|
|
podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:${{ steps.version.outputs.major_minor }} .
|
|
podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:latest .
|
|
podman push codeberg.org/lvl0/incr:${{ steps.version.outputs.version }}
|
|
podman push codeberg.org/lvl0/incr:${{ steps.version.outputs.major_minor }}
|
|
podman push codeberg.org/lvl0/incr:latest
|
|
else
|
|
podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:latest .
|
|
podman push codeberg.org/lvl0/incr:latest
|
|
fi |