Compare commits
3 Commits
916c3142d4
...
image
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aea858a1ef | ||
|
|
85c90e4657 | ||
|
|
840ecedbd0 |
56
.gitea/workflows/docker-image.yml
Normal file
56
.gitea/workflows/docker-image.yml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
name: Build And Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "image"
|
||||||
|
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: Determine next timestamp tag
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
TODAY="$(date -u +%Y%m%d)"
|
||||||
|
i=1
|
||||||
|
while docker manifest inspect "${BASE_IMAGE}:${TODAY}-${i}" > /dev/null 2>&1; do
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
DATE_TAG="${TODAY}-${i}"
|
||||||
|
echo "DATE_TAG=${DATE_TAG}" >> "$GITHUB_ENV"
|
||||||
|
echo "Using image tag: ${DATE_TAG}"
|
||||||
|
|
||||||
|
- name: Build docker image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
-f ./Docker/dockerfile.server \
|
||||||
|
-t "${{ env.BASE_IMAGE }}:latest" \
|
||||||
|
-t "${{ env.BASE_IMAGE }}:${{ env.DATE_TAG }}" \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Push docker images
|
||||||
|
run: |
|
||||||
|
docker push "${{ env.BASE_IMAGE }}:latest"
|
||||||
|
docker push "${{ env.BASE_IMAGE }}:${{ env.DATE_TAG }}"
|
||||||
50
.gitea/workflows/test.yml
Normal file
50
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
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 }}
|
||||||
Reference in New Issue
Block a user