Skip to content

Fix: Avoid assembly loading in MSBuild task (#25) #12

Fix: Avoid assembly loading in MSBuild task (#25)

Fix: Avoid assembly loading in MSBuild task (#25) #12

Workflow file for this run

name: Release
on:
push:
branches:
- 'release/v*'
jobs:
verify-frameworks:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.0', '9.0', '10.0']
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Build Example Apps
run: |
dotnet build tests/SimpleBranchVersioning.ExampleApp -c Release
dotnet build tests/SimpleBranchVersioning.ConfiguredApp -c Release
- name: Run ExampleApp
run: dotnet run --project tests/SimpleBranchVersioning.ExampleApp -f net${{ matrix.dotnet-version }} -c Release --no-build
- name: Run ConfiguredApp
run: dotnet run --project tests/SimpleBranchVersioning.ConfiguredApp -f net${{ matrix.dotnet-version }} -c Release --no-build
- name: Verify version.json
run: |
# ConfiguredApp should have version.json (GenerateVersionFile=true)
if [ ! -f "tests/SimpleBranchVersioning.ConfiguredApp/bin/Release/net${{ matrix.dotnet-version }}/version.json" ]; then
echo "::error::ConfiguredApp is missing version.json for net${{ matrix.dotnet-version }}"
exit 1
fi
echo "ConfiguredApp version.json exists for net${{ matrix.dotnet-version }}"
cat tests/SimpleBranchVersioning.ConfiguredApp/bin/Release/net${{ matrix.dotnet-version }}/version.json
# ExampleApp should NOT have version.json (GenerateVersionFile=false by default)
if [ -f "tests/SimpleBranchVersioning.ExampleApp/bin/Release/net${{ matrix.dotnet-version }}/version.json" ]; then
echo "::error::ExampleApp should not have version.json for net${{ matrix.dotnet-version }}"
exit 1
fi
echo "ExampleApp correctly has no version.json for net${{ matrix.dotnet-version }}"
release:
needs: verify-frameworks
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Extract version from branch
id: version
run: |
BRANCH=${GITHUB_REF#refs/heads/}
VERSION=${BRANCH#release/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release -p:Version=${{ steps.version.outputs.version }}
- name: Test
run: dotnet test --no-build -c Release --verbosity normal
- name: Pack
run: dotnet pack src/SimpleBranchVersioning/SimpleBranchVersioning.csproj --no-build -c Release -o ./artifacts -p:Version=${{ steps.version.outputs.version }}
- name: NuGet login
id: nuget-login
uses: nuget/login@v1
with:
user: ${{ secrets.NUGET_USER }}
- name: Publish to NuGet
run: dotnet nuget push ./artifacts/*.nupkg --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.tag }}
generate_release_notes: true
files: ./artifacts/*.nupkg