Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 0 additions & 95 deletions .github/workflows/build.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: 🏭 Build executables

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main

env:
DOTNET_VERSION: "10.x"

permissions:
contents: write
pull-requests: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
# cache: true
# cache-dependency-path: "**/packages.lock.json"

- name: Restore dependencies
run: dotnet restore

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4.5.0

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v4.5.0
with:
updateProjectFiles: true

- name: Build server
run: dotnet build --no-restore -c Release

- name: Test
run: dotnet test --no-build -c Release --verbosity normal

- name: Build database migration
working-directory: Data
run: |
dotnet tool install dotnet-ef
dotnet ef migrations bundle --self-contained -r linux-x64 --force -o ../artifacts/efbundle
136 changes: 136 additions & 0 deletions .github/workflows/release-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: 🏭 Build Calendare Server

on:
push:
tags:
- "v[0-9]*.[0-9]*.[0-9]*" # Pattern for standard: v1.2.3
- "v[0-9]*.[0-9]*.[0-9]*-*" # Pattern for pre-release: v1.2.3-alpha.1

env:
REGISTRY: ghcr.io
CHART_REPO: charts
DOTNET_VERSION: "10.x"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pull-requests: read

steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Extract repo names
id: repoinfo
shell: bash
run: |
REPOSITORY_LC=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "repository_lc=$REPOSITORY_LC" >> $GITHUB_OUTPUT
REPOSITORY_OWNER_LC=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
echo "repository_owner_lc=$REPOSITORY_OWNER_LC" >> $GITHUB_OUTPUT

- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4.5.0

- name: Determine Version
id: meta
uses: gittools/actions/gitversion/execute@v4.5.0

- name: Log in to registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Publish server container to registry
env:
REPOSITORY_LC: ${{ steps.repoinfo.outputs.repository_lc }}
IMAGE_NAME: "calendare-server"
ContainerImageTags: >-
${{ steps.meta.outputs.PreReleaseLabel != ''
&& format('{0};{1};{2}', steps.meta.outputs.SemVer, steps.meta.outputs.MajorMinorPath, steps.meta.outputs.InformationalVersion)
|| format('{0};{1}.{2};{3};latest', steps.meta.outputs.SemVer, steps.meta.outputs.Major, steps.meta.outputs.Minor, steps.meta.outputs.InformationalVersion)
}}
run: |
dotnet publish --os linux --arch x64 /t:PublishContainer \
-p ContainerRegistry=${{ env.REGISTRY }} \
-p ContainerRepository=${REPOSITORY_LC}/${IMAGE_NAME}

- name: Build database migration
working-directory: Data
run: |
dotnet tool install dotnet-ef
dotnet ef migrations bundle --self-contained -r linux-x64 --force -o ../artifacts/efbundle

- name: Set up Buildx
uses: docker/setup-buildx-action@v4

- name: Build and push database migration container image
if: steps.meta.outputs.PreReleaseLabel == ''
uses: docker/build-push-action@v7
with:
context: .
file: ./Containerfile.migration
push: true
# sbom: true
build-args: |
BUILD_DATE=${{ steps.meta.outputs.CommitDate }}
SEMVER2=${{ steps.meta.outputs.SemVer }}
tags: |
${{ env.REGISTRY }}/${{ steps.repoinfo.outputs.repository_lc }}/calendare-migration:latest
${{ env.REGISTRY }}/${{ steps.repoinfo.outputs.repository_lc }}/calendare-migration:${{ steps.meta.outputs.SemVer }}
${{ env.REGISTRY }}/${{ steps.repoinfo.outputs.repository_lc }}/calendare-migration:${{ steps.meta.outputs.MajorMinorPatch }}
${{ env.REGISTRY }}/${{ steps.repoinfo.outputs.repository_lc }}/calendare-migration:${{ steps.meta.outputs.Major }}.${{ steps.meta.outputs.Minor }}
${{ env.REGISTRY }}/${{ steps.repoinfo.outputs.repository_lc }}/calendare-migration:${{ steps.meta.outputs.InformationalVersion }}

- name: Build and push database migration container image (pre-release)
if: steps.meta.outputs.PreReleaseLabel != ''
uses: docker/build-push-action@v7
with:
context: .
file: ./Containerfile.migration
push: true
# sbom: true
build-args: |
BUILD_DATE=${{ steps.meta.outputs.CommitDate }}
SEMVER2=${{ steps.meta.outputs.SemVer }}
tags: |
${{ env.REGISTRY }}/${{ steps.repoinfo.outputs.repository_lc }}/calendare-migration:${{ steps.meta.outputs.SemVer }}
${{ env.REGISTRY }}/${{ steps.repoinfo.outputs.repository_lc }}/calendare-migration:${{ steps.meta.outputs.MajorMinorPatch }}
${{ env.REGISTRY }}/${{ steps.repoinfo.outputs.repository_lc }}/calendare-migration:${{ steps.meta.outputs.InformationalVersion }}

- name: Get chart name
id: chartname
uses: mikefarah/yq@master
with:
cmd: yq -r .name deploy/Chart.yaml

- name: Push Helm chart
env:
VERSION: ${{ steps.meta.outputs.SemVer }}
REPOSITORY_OWNER_LC: ${{ steps.repoinfo.outputs.repository_owner_lc }}
CHART_NAME: ${{ steps.chartname.outputs.result }}
run: |
helm package ./deploy --version "$VERSION" --app-version "$VERSION"
helm push ${CHART_NAME}-${VERSION}.tgz oci://${{ env.REGISTRY }}/${REPOSITORY_OWNER_LC}/${{ env.CHART_REPO }}

- name: Create Release
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
with:
tag_name: ${{ github.ref_name }}
name: "${{ github.ref_name }}"
generate_release_notes: true
draft: false
prerelease: ${{ steps.gitversion.outputs.PreReleaseTag != '' }}
11 changes: 5 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<PrivateAssets>all</PrivateAssets>
<Version>3.9.50</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<Company>closure.ch</Company>
<Copyright>© 2024-2026 Closure OSS Contributors</Copyright>
Expand All @@ -18,4 +12,9 @@
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<!-- <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> -->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="6.7.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
10 changes: 10 additions & 0 deletions GitVersion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
workflow: GitHubFlow/v1
mode: ContinuousDelivery
branches:
main:
label: "beta"
feature:
mode: ContinuousDelivery
assembly-versioning-format: '{MajorMinorPatch}.{WeightedPreReleaseNumber}'
assembly-file-versioning-format: '{MajorMinorPatch}.{WeightedPreReleaseNumber}'
assembly-informational-format: '{MajorMinorPatch}.{WeightedPreReleaseNumber}'
2 changes: 1 addition & 1 deletion Server/Api/SiteApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static RouteGroupBuilder MapSiteApi(this RouteGroupBuilder api)
{
var response = new FeatureResponse
{
Version = ThisAssembly.AssemblyInformationalVersion,
Version = GitVersionInformation.SemVer,
PathBase = env.PathBase,
};
foreach (var feature in Enum.GetValues<CalendareFeatures>())
Expand Down
2 changes: 1 addition & 1 deletion Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
c.SwaggerDoc("v1", new OpenApiInfo
{
Title = "Calendare Server",
Version = ThisAssembly.AssemblyFileVersion,
Version = GitVersionInformation.SemVer,
Description = "Administration API for the Calendare Server",
Contact = new OpenApiContact
{
Expand Down
17 changes: 0 additions & 17 deletions version.json

This file was deleted.