chore: same updates as v7 branch #38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Verify Build | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PATH_TO_EXTENSION: "src/Slimsy" | |
| DOTNET_VERSION: '8' | |
| on: | |
| push: | |
| branches: [ "dev-v5", "main-v5" ] | |
| pull_request: | |
| branches: | |
| - dev-v5 | |
| - main-v5 | |
| workflow_dispatch: | |
| jobs: | |
| setup: | |
| name: Setup | |
| runs-on: ubuntu-latest | |
| outputs: | |
| semver: ${{ steps.set-version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch all tags | |
| run: git fetch --force --tags | |
| - name: Semantic Release | |
| id: semantic | |
| uses: cycjimmy/semantic-release-action@v6 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| dry_run: true | |
| extra_plugins: | | |
| @semantic-release/exec | |
| @semantic-release/commit-analyzer | |
| @semantic-release/release-notes-generator | |
| @semantic-release/github | |
| conventional-changelog-conventionalcommits | |
| - name: Set Version | |
| id: set-version | |
| run: | | |
| if [ -n "${{ steps.semantic.outputs.new_release_version }}" ]; then | |
| echo "version=${{ steps.semantic.outputs.new_release_version }}" >> $GITHUB_OUTPUT | |
| else | |
| # Get the latest tag from git | |
| LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| if [ -n "$LATEST_TAG" ]; then | |
| # Remove 'v' prefix if present | |
| LATEST_VERSION=${LATEST_TAG#v} | |
| echo "version=${LATEST_VERSION}-dev.${{ github.run_number }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=0.1.0-dev.${{ github.run_number }}" >> $GITHUB_OUTPUT | |
| fi | |
| fi | |
| - name: Echo the version | |
| run: | | |
| echo "Version to use: '${{ steps.set-version.outputs.version }}'" | |
| echo "New release version: '${{ steps.semantic.outputs.new_release_version }}'" | |
| echo "New release major: '${{ steps.semantic.outputs.new_release_major_version }}'" | |
| echo "New release minor: '${{ steps.semantic.outputs.new_release_minor_version }}'" | |
| echo "New release patch: '${{ steps.semantic.outputs.new_release_patch_version }}'" | |
| echo "Last release version: '${{ steps.semantic.outputs.last_release_version }}'" | |
| echo "New release published: '${{ steps.semantic.outputs.new_release_published }}'" | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache NuGet | |
| id: nuget-packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-cache-${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj*') }} | |
| restore-keys: | | |
| nuget-cache-${{ runner.os }}-nuget- | |
| - name: Update Version Files | |
| id: update-version | |
| run: .github/scripts/update-version-files.sh "${{ needs.setup.outputs.semver }}" "${{ env.PATH_TO_EXTENSION }}" | |
| - name: Build slnx | |
| run: dotnet build ${{ github.workspace }}/*.slnx -c Release /maxcpucount:1 | |
| - name: Pack NuGet Package | |
| working-directory: ${{ env.PATH_TO_EXTENSION }} | |
| run: dotnet pack --configuration Release /p:PackageVersion=${{ needs.setup.outputs.semver }} /p:FileVersion=${{ steps.update-version.outputs.file_version }} | |
| - name: Install Package Validation Tool | |
| run: dotnet tool install -g dotnet-validate --prerelease | |
| - name: Validate NuGet Package | |
| run: dotnet validate package local ${{ env.PATH_TO_EXTENSION }}/bin/Release/Our.Umbraco.Slimsy.${{ needs.setup.outputs.semver }}.nupkg |