From bd179420a015e74755e7a9c3c7ef79b6fd66171b Mon Sep 17 00:00:00 2001 From: Davidson Sousa Date: Sun, 26 Oct 2025 12:32:50 +0100 Subject: [PATCH 1/5] Clean up --- azure-pipelines.yml | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index bf56801d..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,34 +0,0 @@ -# ASP.NET -# Build and test ASP.NET projects. -# Add steps that publish symbols, save build artifacts, deploy, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 - -trigger: -- main - -pool: - vmImage: 'windows-latest' - -variables: - solution: '**/*.sln' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - -steps: -- task: NuGetToolInstaller@1 - -- task: NuGetCommand@2 - inputs: - restoreSolution: '$(solution)' - -- task: VSBuild@1 - inputs: - solution: '$(solution)' - msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - -- task: VSTest@2 - inputs: - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' From ecfb3dad5af822e9a14d2b5406e21dc65391c191 Mon Sep 17 00:00:00 2001 From: Davidson Sousa Date: Sun, 26 Oct 2025 12:33:12 +0100 Subject: [PATCH 2/5] Rename dotnet.yml to build-test.yml --- .github/workflows/{dotnet.yml => build-test.yml} | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename .github/workflows/{dotnet.yml => build-test.yml} (90%) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/build-test.yml similarity index 90% rename from .github/workflows/dotnet.yml rename to .github/workflows/build-test.yml index d3960f8c..18d0ec1b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/build-test.yml @@ -1,14 +1,16 @@ -name: Feature - Build and test +name: Build and Test on: push: - branches: [ "feature/**" ] + branches: [ "feature/**", "develop" ] paths-ignore: - '**.md' - 'docs/**' - '.gitignore' - 'LICENSE' - '.editorconfig' + pull_request: + branches: [ "develop", "main" ] jobs: build-test: @@ -18,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v5 with: - fetch-depth: 0 # Fetch all history for better versioning + fetch-depth: 0 - name: Setup .NET uses: actions/setup-dotnet@v5 From deb6981ba9561ab4bc39aa219462e7884fc9ad2d Mon Sep 17 00:00:00 2001 From: Davidson Sousa Date: Sun, 26 Oct 2025 12:33:30 +0100 Subject: [PATCH 3/5] Add preview and release workflows --- .github/workflows/preview.yml | 69 ++++++++++++++++++++++++ .github/workflows/release.yml | 98 +++++++++++++++++++++++++++++++++++ CmsEngine.sln | 4 +- 3 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/preview.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 00000000..f6da30cf --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,69 @@ +name: Preview Build + +on: + push: + branches: [ "develop" ] + paths-ignore: + - '**.md' + - 'docs/**' + - '.gitignore' + - 'LICENSE' + - '.editorconfig' + +jobs: + preview: + name: Create preview package + runs-on: ubuntu-latest + environment: Preview + + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 9.0.x + + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/packages.props') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: Restore dependencies + run: dotnet restore + + - name: Set preview version + id: version + run: | + VERSION=$(date +'%Y.%m.%d').${{ github.run_number }} + echo "Version: $VERSION-preview" + echo "package_version=$VERSION-preview" >> $GITHUB_OUTPUT + + - name: Build + run: > + dotnet build --configuration Release --no-restore + /p:ContinuousIntegrationBuild=true + /p:Version=${{ steps.version.outputs.package_version }} + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Publish MVC App + run: > + dotnet publish CmsEngine.Ui/CmsEngine.Ui.csproj + --configuration Release + --no-build + --output ./publish + /p:Version=${{ steps.version.outputs.package_version }} + + - name: Upload MVC App artifact + uses: actions/upload-artifact@v4 + with: + name: mvc-app + path: publish/ + retention-days: 7 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..271978bf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,98 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + workflow_dispatch: + inputs: + version: + description: 'Release version (without v prefix)' + required: true + type: string + +jobs: + release: + name: Create release + runs-on: ubuntu-latest + environment: Production + + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 9.0.x + + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/packages.props') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: Set version + id: version + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION=${{ github.event.inputs.version }} + else + VERSION=${GITHUB_REF#refs/tags/v} + fi + echo "Version: $VERSION" + echo "package_version=$VERSION" >> $GITHUB_OUTPUT + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: > + dotnet build --configuration Release --no-restore + /p:ContinuousIntegrationBuild=true + /p:Version=${{ steps.version.outputs.package_version }} + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Publish MVC App + run: > + dotnet publish CmsEngine.Ui/CmsEngine.Ui.csproj + --configuration Release + --no-build + --output ./publish + /p:Version=${{ steps.version.outputs.package_version }} + + - name: Create ZIP file + run: | + cd publish + zip -r ../CmsEngine-${{ steps.version.outputs.package_version }}.zip . + cd .. + + - name: Generate changelog + id: changelog + uses: metcalfc/changelog-generator@v4.1.0 + with: + myToken: ${{ secrets.GITHUB_TOKEN }} + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: CmsEngine-${{ steps.version.outputs.package_version }}.zip + name: Release ${{ steps.version.outputs.package_version }} + body: ${{ steps.changelog.outputs.changelog }} + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload artifact for debugging + uses: actions/upload-artifact@v4 + with: + name: mvc-app + path: publish/ + retention-days: 7 \ No newline at end of file diff --git a/CmsEngine.sln b/CmsEngine.sln index 3d653bbd..d8c87774 100644 --- a/CmsEngine.sln +++ b/CmsEngine.sln @@ -24,7 +24,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{02EA EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{417CF032-20B7-4521-984B-11D57C462BEA}" ProjectSection(SolutionItems) = preProject - .github\workflows\dotnet.yml = .github\workflows\dotnet.yml + .github\workflows\build-test.yml = .github\workflows\build-test.yml + preview.yml = preview.yml + release.yml = release.yml EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmsEngine.Tests", "tests\CmsEngine.Tests\CmsEngine.Tests.csproj", "{6F257EAE-CC97-4ADB-A892-452C0404BFAC}" From 7dc47ed5a8ab70fa36d6063e4197f467921c5a1d Mon Sep 17 00:00:00 2001 From: Davidson Sousa Date: Sun, 26 Oct 2025 12:34:50 +0100 Subject: [PATCH 4/5] Update readme file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b5633110..b552fc4f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # CmsEngine ## Build status -![CmsEngine](https://github.com/davidsonsousa/CmsEngine/actions/workflows/dotnet.yml/badge.svg) +![CmsEngine](https://github.com/davidsonsousa/CmsEngine/actions/workflows/build-test.yml/badge.svg) ## What is it? This the code-base of the CMS I am using in my website [https://davidsonsousa.net](https://davidsonsousa.net "my website"). From 111fcd182254d266d6b86b93ed31dca8d6868f8a Mon Sep 17 00:00:00 2001 From: Davidson Sousa Date: Sun, 26 Oct 2025 12:46:57 +0100 Subject: [PATCH 5/5] Fix project path --- preview.yml | 69 +++++++++++++++++++++++++++++++++++++ release.yml | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 preview.yml create mode 100644 release.yml diff --git a/preview.yml b/preview.yml new file mode 100644 index 00000000..99cd9d7b --- /dev/null +++ b/preview.yml @@ -0,0 +1,69 @@ +name: Preview Build + +on: + push: + branches: [ "develop" ] + paths-ignore: + - '**.md' + - 'docs/**' + - '.gitignore' + - 'LICENSE' + - '.editorconfig' + +jobs: + preview: + name: Create preview package + runs-on: ubuntu-latest + environment: Preview + + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 9.0.x + + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/packages.props') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: Restore dependencies + run: dotnet restore + + - name: Set preview version + id: version + run: | + VERSION=$(date +'%Y.%m.%d').${{ github.run_number }} + echo "Version: $VERSION-preview" + echo "package_version=$VERSION-preview" >> $GITHUB_OUTPUT + + - name: Build + run: > + dotnet build --configuration Release --no-restore + /p:ContinuousIntegrationBuild=true + /p:Version=${{ steps.version.outputs.package_version }} + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Publish MVC App + run: > + dotnet publish src/CmsEngine.Ui/CmsEngine.Ui.csproj + --configuration Release + --no-build + --output ./publish + /p:Version=${{ steps.version.outputs.package_version }} + + - name: Upload MVC App artifact + uses: actions/upload-artifact@v4 + with: + name: mvc-app + path: publish/ + retention-days: 7 \ No newline at end of file diff --git a/release.yml b/release.yml new file mode 100644 index 00000000..a65fff12 --- /dev/null +++ b/release.yml @@ -0,0 +1,98 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + workflow_dispatch: + inputs: + version: + description: 'Release version (without v prefix)' + required: true + type: string + +jobs: + release: + name: Create release + runs-on: ubuntu-latest + environment: Production + + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 9.0.x + + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/packages.props') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: Set version + id: version + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION=${{ github.event.inputs.version }} + else + VERSION=${GITHUB_REF#refs/tags/v} + fi + echo "Version: $VERSION" + echo "package_version=$VERSION" >> $GITHUB_OUTPUT + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: > + dotnet build --configuration Release --no-restore + /p:ContinuousIntegrationBuild=true + /p:Version=${{ steps.version.outputs.package_version }} + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Publish MVC App + run: > + dotnet publish src/CmsEngine.Ui/CmsEngine.Ui.csproj + --configuration Release + --no-build + --output ./publish + /p:Version=${{ steps.version.outputs.package_version }} + + - name: Create ZIP file + run: | + cd publish + zip -r ../CmsEngine-${{ steps.version.outputs.package_version }}.zip . + cd .. + + - name: Generate changelog + id: changelog + uses: metcalfc/changelog-generator@v4.1.0 + with: + myToken: ${{ secrets.GITHUB_TOKEN }} + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: CmsEngine-${{ steps.version.outputs.package_version }}.zip + name: Release ${{ steps.version.outputs.package_version }} + body: ${{ steps.changelog.outputs.changelog }} + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload artifact for debugging + uses: actions/upload-artifact@v4 + with: + name: mvc-app + path: publish/ + retention-days: 7 \ No newline at end of file