Bump actions/download-artifact from 1 to 4.1.7 in /.github/workflows #283
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: CI CollectSFData | |
env: | |
project_name: CollectSFData | |
project_root: ${{ github.workspace }}\\src | |
artifacts_path: ${{ github.workspace }}\\src\\bin\\artifacts | |
release_path: ${{ github.workspace }}\\src\\bin\\Release | |
release_config: ${{ github.workspace }}\\configurationFiles\\collectsfdata.options.json | |
github_owner: ${{ github.event.repository.owner.name }} | |
on: | |
pull_request_target: | |
types: [closed, opened] | |
paths-ignore: | |
- "docs/**" | |
- "configurationFiles/**" | |
- "kusto/**" | |
branches: | |
- master | |
- main | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v1 | |
- name: environment | |
shell: cmd | |
run: | | |
set | |
dotnet --info | |
dotnet nuget locals all --clear | |
- name: dotnet restore | |
shell: powershell | |
run: | | |
# delete ado internal nuget config for external build | |
$adoInternalNugetConfig = ".\Nuget.Config" | |
if(Test-Path $adoInternalNugetConfig) { | |
write-host "deleting ado internal nuget config: $adoInternalNugetConfig" | |
del $adoInternalNugetConfig | |
} | |
write-host "dotnet restore $env:project_root\$env:project_name\$env:project_name.csproj -v detailed" | |
dotnet restore $env:project_root\$env:project_name\$env:project_name.csproj -v detailed | |
- name: dotnet build / pack | |
shell: cmd | |
run: | | |
set | |
dotnet build %project_root%\%project_name%\%project_name%.csproj -v detailed -c Release | |
dir | |
- name: build output | |
shell: cmd | |
run: | | |
set | |
dir /s | |
- name: copy artifacts | |
shell: powershell | |
run: | | |
[environment]::GetEnvironmentVariables() | |
write-host "copy "$($env:release_path)" "$($env:artifacts_path)" -recurse -force" | |
copy "$($env:release_path)" "$($env:artifacts_path)" -recurse -force | |
write-host "copy "$($env:release_config)" "$($env:artifacts_path)" -recurse -force" | |
copy "$($env:release_config)" "$($env:artifacts_path)" -recurse -force | |
dir "$($env:artifacts_path)" -recurse | |
- name: artifacts output | |
shell: powershell | |
run: dir "$($env:artifacts_path)" -recurse | |
- name: upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: Release | |
path: ${{ env.artifacts_path }} | |
release: | |
if: success() && github.event.pull_request.merged == true && github.event.action == 'closed' && (contains(github.event.pull_request.labels.*.name, 'Release') || contains(github.event.pull_request.labels.*.name, 'Pre-release')) | |
needs: build | |
runs-on: windows-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: checkout | |
uses: actions/checkout@v1 | |
- name: environment | |
shell: cmd | |
run: set | |
- name: download artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: Release | |
path: ${{ env.release_path }} | |
- name: release output | |
shell: powershell | |
run: dir "$($env:release_path)" -recurse | |
- name: set nuget package | |
shell: powershell | |
id: set_nuget_package | |
run: | | |
$nugetPackage = (get-item "$($env:release_path)\*.nupkg").FullName | |
$nugetPackageName = (get-item "$($env:release_path)\*.nupkg").Name | |
echo "nuget_package=$nugetPackage" >> $env:GITHUB_OUTPUT | |
echo "nuget_package_name=$nugetPackageName" >> $env:GITHUB_OUTPUT | |
write-host "nuget_package=$nugetPackage" | |
write-host "nuget_package_name=$nugetPackageName" | |
- name: prepare release asset | |
shell: powershell | |
id: prepare_release_asset | |
run: | | |
$source = "$($env:release_path)\\*" | |
$destination = "$($env:release_path)\\$($env:project_name).zip" | |
write-host "compress-archive -path $source -destinationPath $destination -force" | |
compress-archive -path $source -destinationPath $destination -force | |
$exeFileRef = @(get-childItem -recurse "$($env:release_path)\$($env:project_name).exe")[0].FullName | |
$fileVersion = [io.fileinfo]::new($exeFileRef).VersionInfo.FileVersion | |
write-host "fileVersion=$fileVersion" | |
echo "::log-command parameter1=$fileVersion::fileVersion" | |
echo "file_version=v$fileVersion" >> $env:GITHUB_OUTPUT | |
write-host "dir $env:release_path -recurse" | |
dir $env:release_path -recurse | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/marketplace/actions/gh-release | |
- name: create release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
**/${{ env.project_name }}.zip | |
**/*${{ env.project_name }}*.nupkg | |
tag_name: ${{ steps.prepare_release_asset.outputs.file_version }} | |
name: ${{ env.project_name }} | |
draft: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: ${{ contains(github.event.pull_request.labels.*.name, 'Pre-release') }} | |
generate_release_notes: true |