Add GitHub Actions workflow for building and pushing development Docker image
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 1m47s

This commit is contained in:
troogs
2026-04-18 12:41:38 +02:00
parent 3687e573e0
commit c5c24d44c9
2 changed files with 41 additions and 50 deletions

View File

@@ -0,0 +1,41 @@
name: Build And Push Dev Docker Image
on:
push:
branches:
- master
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
env:
DOTNET_ROLL_FORWARD: Major
REGISTRY: git.beging.de
BASE_IMAGE: git.beging.de/troogs/fs-onboarding-server
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: "9.0.x"
- name: Publish server project
run: dotnet publish ./FoodsharingSiegen.Server/FoodsharingSiegen.Server.csproj -c Release -o ./Publish/Server
- name: Login to Gitea registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${{ env.REGISTRY }}" -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
- name: Build docker image
run: |
docker build \
-f ./Docker/dockerfile.server \
-t "${{ env.BASE_IMAGE }}:dev" \
.
- name: Push docker images
run: |
docker push "${{ env.BASE_IMAGE }}:dev"

View File

@@ -1,50 +0,0 @@
name: Build And Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: "Tag for the release (for example: v1.0.0)"
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
env:
RELEASE_TAG: ${{ github.event.inputs.tag_name || github.ref_name }}
DOTNET_ROLL_FORWARD: Major
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: "9.0.x"
- name: Restore dependencies
run: dotnet restore FoodsharingSiegen.sln
- name: Publish server build
run: dotnet publish ./FoodsharingSiegen.Server/FoodsharingSiegen.Server.csproj -c Release -o ./artifacts/publish
- name: Create zip package
run: |
cd artifacts
zip -r FoodsharingSiegen.Server-${{ env.RELEASE_TAG }}.zip publish
- name: Create release and upload artifact
uses: https://gitea.com/actions/gitea-release-action@v1
with:
files: artifacts/FoodsharingSiegen.Server-${{ env.RELEASE_TAG }}.zip
tag_name: ${{ env.RELEASE_TAG }}
name: Release ${{ env.RELEASE_TAG }}
target_commitish: ${{ github.sha }}
token: ${{ github.token }}