From 02a845c711cc8500584e83820e8e477bbc68fc75 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Wed, 14 May 2025 21:07:34 +0200 Subject: [PATCH 1/3] Add CI scripts to build the module automatically --- .gitea/workflows/ci.yml | 19 +++++++++++++++++++ .gitea/workflows/release.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..58bbf36 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,19 @@ +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout + uses: https://github.com/actions/checkout@v4 + - name: Build + run: dotnet build --configuration Release + - name: Test + run: dotnet test --configuration Release --no-build \ No newline at end of file diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..065b80e --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,33 @@ +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + release: + types: + - published + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout + uses: https://github.com/actions/checkout@v4 + - name: Verify commit exists in origin/main + run: | + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + git branch --remote --contains | grep origin/main + - name: Set VERSION variable from tag + run: echo "VERSION=${GITEA_REF/refs\/tags\/v/}" >> $GITEA_ENV + - name: Build + run: dotnet build --configuration Release /p:Version=${VERSION} + - name: Test + run: dotnet test --configuration Release /p:Version=${VERSION} --no-build + - name: Pack + run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output . + - uses: https://github.com/actions/upload-artifact@v4 + with: + name: nuget + if-no-files-found: error + retention-days: 7 + path: ./*.nupkg \ No newline at end of file -- 2.47.2 From d967449889184222dc169390e2c69074dc625224 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Wed, 14 May 2025 21:50:56 +0200 Subject: [PATCH 2/3] CI: Add CI branch as trigger for testing --- .gitea/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 58bbf36..d950e2b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -2,9 +2,11 @@ on: push: branches: - main + - ci pull_request: branches: - main + - ci jobs: build: -- 2.47.2 From 13587ea2102df07fa405c535de31f64d09098510 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Wed, 14 May 2025 21:56:48 +0200 Subject: [PATCH 3/3] CI: Setup dotnet SDK before running automatic build --- .gitea/workflows/ci.yml | 37 ++++++++++++++++++++++++++++++++---- .gitea/workflows/release.yml | 2 ++ Package/release.sh | 8 ++++++-- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d950e2b..93eca2e 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -13,9 +13,38 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - name: Checkout + - name: Checkout Module uses: https://github.com/actions/checkout@v4 - - name: Build - run: dotnet build --configuration Release + with: + path: Module.EventRegistration + - name: Checkout Oqtane + uses: https://github.com/actions/checkout@v4 + with: + repository: Diplomarbeit-Absolventenverein/oqtane.framework + path: oqtane.framework + ref: v6.1.1 + - name: Setup Dotnet SDK + uses: https://github.com/actions/setup-dotnet@v4 + with: + dotnet-version: '9.x' + # - name: Setup NuGet + # uses: https://github.com/nuget/setup-nuget@v2 + # with: + # nuget-api-key: ${{ secrets.NuGetAPIKey }} + # nuget-version: '5.x' + - name: Build Oqtane + run: dotnet build ./oqtane.framework/Oqtane.sln --configuration Debug + - name: Build Module + run: dotnet build ./Module.EventRegistration/SZUAbsolventenverein.Module.EventRegistration.sln --configuration Release - name: Test - run: dotnet test --configuration Release --no-build \ No newline at end of file + run: dotnet test ./Module.EventRegistration/SZUAbsolventenverein.Module.EventRegistration.sln --configuration Release --no-build + - name: Create Release + uses: akkuman/gitea-release-action@v1 + env: + NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18 + with: + body: "Test-release" + draft: true + files: |- + ./**/*.nupkg + ./*.nupkg \ No newline at end of file diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 065b80e..95bfc12 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -19,6 +19,8 @@ jobs: git branch --remote --contains | grep origin/main - name: Set VERSION variable from tag run: echo "VERSION=${GITEA_REF/refs\/tags\/v/}" >> $GITEA_ENV + - name: Setup Dotnet SDK + uses: https://github.com/actions/setup-dotnet@v4 - name: Build run: dotnet build --configuration Release /p:Version=${VERSION} - name: Test diff --git a/Package/release.sh b/Package/release.sh index 0fd258f..fc8e8e1 100644 --- a/Package/release.sh +++ b/Package/release.sh @@ -1,5 +1,9 @@ TargetFramework=$1 ProjectName=$2 -"..\..\oqtane.framework\oqtane.package\nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName% -cp -f "*.nupkg" "..\..\oqtane.framework\Oqtane.Server\Packages\" \ No newline at end of file +# chmod +x ../../oqtane.framework/Oqtane.Package/nuget.exe +# "../../oqtane.framework/Oqtane.Package/nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName% +# https://learn.microsoft.com/en-us/nuget/reference/dotnet-commands +dotnet pack SZUAbsolventenverein.Module.EventRegistration.Package.csproj --no-build + +#cp -f "*.nupkg" "..\..\oqtane.framework\Oqtane.Server\Packages\" -- 2.47.2