Skip to content

Update main.yml

Update main.yml #84

Workflow file for this run

name: Build on Github servers
on:
push:
pull_request:
jobs:
build:
runs-on: windows-latest
defaults:
run:
working-directory: .
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup msbuild
uses: microsoft/[email protected]
with:
vs-version: '12.0'
- name: Restore Packages
run: Nuget restore SourceGrid_2013.sln
- name: Build
run: msbuild -m -t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" /fl SourceGrid_2013.sln
- name: Archive Build Log
uses: actions/upload-artifact@v2
if: ${{ success() || failure() }}
with:
name: Compile_Solution_log
path: |
*.log
- name: Create zip
id: packageBuildResults
run: |
$sourceFolder = Join-Path $env:GITHUB_WORKSPACE "out" | Join-Path -ChildPath "*"
$outFolder = Join-Path $env:GITHUB_WORKSPACE "out" | Join-Path -ChildPath "sourcegrid"
New-Item -ItemType Directory -Force -Path $outFolder
$fileName = "sourcegrid-1.0.0.zip"
Write-Host "Filename: '$fileName'"
Write-Host "sourceFolder: '$sourceFolder'"
Write-Host "Outfolder: '$outFolder'"
Write-Host "::set-output name=sourcegrid::$($fileName)"
$outPath = Join-Path $outFolder $fileName
Compress-Archive -DestinationPath $outPath -Path $sourceFolder -CompressionLevel Optimal
- name: Archive Build Output
uses: actions/upload-artifact@v2
with:
name: sourcegrid
path: |
out/sourcegrid
- name: Create Nuget Packages
id: createNupkg
run: |
nuget pack SourceGrid.nuspec -Version 1.0.0
Write-Host "::set-output name=nupkg-TEST::TEST.1.0.0.nupkg"
- name: Archive NuGet Packages
uses: actions/upload-artifact@v2
with:
name: nuget-TEST
path: |
*.nupkg
release:
if: github.ref == 'refs/heads/Github_runner'
runs-on: windows-latest
needs: build
steps:
- name: Download Build Output
uses: actions/download-artifact@v2
with:
name: sourcegrid
- name: Download NuGet Package
uses: actions/download-artifact@v2
with:
name: nuget-sourcegrid
- name: Download NuGet Packages from Release
run: |
Write-Host "GITHUB_REF: '$($env:GITHUB_REF)'"
$prefix = "refs/tags/"
$name = $($env:GITHUB_REF).Substring($prefix.Length)
Write-Host "name: '$name'"
gh release download $name --repo siemens/continuous-clearing --pattern '*.nupkg' --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to github packages
run: |
dotnet nuget add source --username ${{ secrets.USERNAME }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://www.nuget.org"
dotnet nuget push "*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source github
env:
USERNAME: ${{ secrets.USERNAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}