Update version and zip file path in build scripts #80
This file contains 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: .Net | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Extract version | |
id: getversion | |
run: | | |
$xml = [xml](Get-Content DetectiveSpecs/DetectiveSpecs.csproj) | |
$version = $xml.Project.PropertyGroup.Version | |
Add-Content -Path $env:GITHUB_ENV -Value "VERSION=$version" | |
shell: pwsh | |
- name: Check version | |
id: checkversion | |
continue-on-error: true | |
run: | | |
pwsh ./.github/scripts/CheckVersion.ps1 -githubRepository ${{ github.repository }} -version $env:VERSION -accessToken $env:ACCESS_TOKEN | |
shell: pwsh | |
env: | |
VERSION: ${{ env.VERSION }} | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
- name: Setup .NET 8.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup NuGet.exe for use with actions | |
uses: NuGet/setup-nuget@v2 | |
- name: Configure github packages as nuget source | |
env: | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
run: | | |
$uri = "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" | |
dotnet nuget add source --username ${{ github.actor }} --password $env:ACCESS_TOKEN --store-password-in-clear-text --name github $uri | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
- name: Publish | |
run: pwsh ./.github/scripts/Publish.ps1 -project "DetectiveSpecs/DetectiveSpecs.csproj" -version $env:VERSION -workspacePath ${{ runner.workspace }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DetectiveSpecs | |
path: ${{ runner.workspace }}/Staging/Build/ | |
- name: Create Github Release | |
env: | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
VERSION: ${{ env.VERSION }} | |
run: pwsh ./.github/scripts/CreateRelease.ps1 -accessToken $env:ACCESS_TOKEN -version $env:VERSION | |
- name: Upload Asset to Release | |
env: | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
VERSION: ${{ env.VERSION }} | |
RELEASE_ID: ${{ env.RELEASE_ID }} | |
run : pwsh ./.github/scripts/UploadRelease.ps1 -accessToken $env:ACCESS_TOKEN -workspace ${{ runner.workspace }} -releaseId $env:RELEASE_ID -version $env:VERSION |