From d144bf4f3e9ffb7c0ec913383b523a1ea775d05c Mon Sep 17 00:00:00 2001 From: damien Date: Mon, 24 Feb 2025 09:14:30 +0000 Subject: [PATCH] Update .github/workflows/on-push.yml --- .github/workflows/on-push.yml | 69 +++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index 6ea8a09..e78eed0 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -1,8 +1,10 @@ name: build-packages + on: push: branches: - 'master' + jobs: meilisearch-dotnet-packages: runs-on: ubuntu-latest @@ -11,48 +13,61 @@ jobs: permissions: contents: write packages: write + steps: - - name: 'Cleanup build folder' + - name: Cleanup build folder run: | - rm ./* -r || true - rm ./.??* -r || true - - - uses: actions/setup-dotnet@v3 + rm -rf ./* ./.??* || true + + - name: Set up .NET + uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 with: fetch-depth: 0 - - - uses: gittools/actions/gitversion/setup@v1.1.1 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v1.1.1 with: versionSpec: '5.x' - - uses: gittools/actions/gitversion/execute@v1.1.1 + + - name: Determine version with GitVersion + id: gitversion + uses: gittools/actions/gitversion/execute@v1.1.1 with: useConfigFile: true configFilePath: GitVersion.yml - - name: Tag branch + + - name: Tag repository run: | - git tag $GitVersion_SemVer - git push origin $GitVersion_SemVer + git tag ${{ steps.gitversion.outputs.SemVer }} + git push origin ${{ steps.gitversion.outputs.SemVer }} - - name: Set up GitVersion - uses: gittools/actions/gitversion/setup@v0.9.15 - with: - versionSpec: '5.x' - - - uses: gittools/actions/gitversion/execute@v0.9.15 - with: - useConfigFile: true - configFilePath: GitVersion.yml - - - name: Set Package Version + - name: Update package version uses: vers-one/dotnet-project-version-updater@v1.6 with: file: "./meilisearch.NET/meilisearch.NET.csproj" - version: ${{ env.GitVersion_SemVer }} + version: ${{ steps.gitversion.outputs.SemVer }} - - run: dotnet build --configuration Release - - run: dotnet pack ./meilisearch.NET/meilisearch.NET.csproj --output nuget-packages --configuration Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg - - run: dotnet nuget push **/*.nupkg --skip-duplicate -s "https://git.d4m13n.dev/api/packages/damien/nuget/index.json" --api-key ${{secrets.PACKAGE_TOKEN}} + - name: Build and package + run: | + dotnet build --configuration Release + dotnet pack ./meilisearch.NET/meilisearch.NET.csproj --output nuget-packages --configuration Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg + + - name: Publish package to NuGet registry + run: | + dotnet nuget push nuget-packages/*.nupkg --skip-duplicate -s "https://git.d4m13n.dev/api/packages/damien/nuget/index.json" --api-key ${{ secrets.PACKAGE_TOKEN }} + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.gitversion.outputs.SemVer }} + name: Release ${{ steps.gitversion.outputs.SemVer }} + body: "https://git.d4m13n.dev/damien/meilisearch.NET/packages + Automated release of MeiliSearch.NET version ${{ steps.gitversion.outputs.SemVer }}." + files: nuget-packages/*.nupkg + draft: false + prerelease: false