Files
net-base/.gitea/workflows/action.yaml
T
2026-06-25 09:09:48 +02:00

107 lines
3.9 KiB
YAML

name: 'Build docker container'
on:
workflow_dispatch:
inputs:
branch:
description: "Select branch to build"
required: true
type: choice
options:
- 9.0-alpine-23
- 9.0-alpine-22
- 9.0-alpine-21
- 8.0-alpine-22
- 8.0-alpine-21
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ GITHUB_WORKSPACE }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Set build variables
id: variables
run: |
case "${{ inputs.branch }}" in
9.0-alpine-23)
echo "DOTNET_SDK_VERSION=9.0.315" >> $GITHUB_OUTPUT
echo "DOTNET_RUNTIME_VERSION=9.0.17" >> $GITHUB_OUTPUT
echo "ALPINE_VERSION=3.23" >> $GITHUB_OUTPUT
;;
9.0-alpine-22)
echo "DOTNET_SDK_VERSION=9.0.312" >> $GITHUB_OUTPUT
echo "DOTNET_RUNTIME_VERSION=9.0.16" >> $GITHUB_OUTPUT
echo "ALPINE_VERSION=3.22" >> $GITHUB_OUTPUT
;;
9.0-alpine-21)
echo "DOTNET_SDK_VERSION=9.0.308" >> $GITHUB_OUTPUT
echo "DOTNET_RUNTIME_VERSION=9.0.15" >> $GITHUB_OUTPUT
echo "ALPINE_VERSION=3.21" >> $GITHUB_OUTPUT
;;
8.0-alpine-22)
echo "DOTNET_SDK_VERSION=8.0.416" >> $GITHUB_OUTPUT
echo "DOTNET_RUNTIME_VERSION=8.0.17" >> $GITHUB_OUTPUT
echo "ALPINE_VERSION=3.22" >> $GITHUB_OUTPUT
;;
8.0-alpine-21)
echo "DOTNET_SDK_VERSION=8.0.410" >> $GITHUB_OUTPUT
echo "DOTNET_RUNTIME_VERSION=8.0.16" >> $GITHUB_OUTPUT
echo "ALPINE_VERSION=3.21" >> $GITHUB_OUTPUT
;;
*)
echo "Unsupported branch"
exit 1
;;
esac
- name: Install Docker
run: |
echo "Checking docker installation"
if command -v docker &> /dev/null; then
echo "Docker installation found"
else
echo "Docker installation not found. Docker will be installed"
curl -fsSL https://get.docker.com | sh
fi
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Docker login
uses: https://github.com/docker/login-action@v3
with:
registry: git.claeyscloud.com
username: nologin
password: ${{ secrets.PACKAGE_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.documentation=https://git.claeyscloud.com/david/net-base/README.md
images: |
git.claeyscloud.com/david/net-base
tags: |
type=raw,value=${{ inputs.branch }}
type=semver,pattern={{raw}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=sha
- name: Generate random password for certificate
id: password
run:
echo "secret=$(openssl rand -base64 12)" >> $GITHUB_OUTPUT
- name: Build and push
uses: https://github.com/docker/build-push-action@v5
with:
build-args: |
CERT_PASSWORD=${{ steps.password.outputs.secret }}
DOTNET_SDK_VERSION=${{ steps.variables.outputs.DOTNET_SDK_VERSION }}
DOTNET_RUNTIME_VERSION=${{ steps.variables.outputs.DOTNET_RUNTIME_VERSION }}
ALPINE_VERSION=${{ steps.variables.outputs.ALPINE_VERSION }}
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}