# https://taskfile.dev #Called by the vnbuild system to produce builds for my website #https://www.vaughnnugent.com/resources/software #This taskfile performs the build operations for a module, it handles #git code updates, msbuild on solutions, and sleet NuGet feed pushes. #this file must be in the same directory as the solution file version: '3' vars: INT_DIR: '{{ .SCRATCH_DIR }}/obj/{{ .MODULE_NAME }}/' MS_ARGS: '/p:RunAnalyzersDuringBuild=false /p:IntermediateOutputPath="{{ .INT_DIR }}" /p:UseCommonOutputDirectory=true /p:BuildInParallel=true /p:MultiProcessorCompilation=true /p:ErrorOnDuplicatePublishOutputFiles=false' PACK_OUT: '{{ .OUTPUT_DIR }}/{{ .HEAD_SHA }}/pkg' tasks: #called by build pipeline to sync repo update: cmds: - git reset --hard #clean up any local changes - git remote update - git pull origin {{ .BRANCH_NAME }} --verify-signatures #re-write semver after hard reset - dotnet-gitversion.exe /updateprojectfiles #called by build pipeline to build module build: cmds: - echo "building module {{ .MODULE_NAME }}" #build debug mode first - task: build_debug - task: build_release publish: cmds: #git archive in the module directory - git archive --format {{ .ARCHIVE_FILE_FORMAT }} --output {{ .ARCHIVE_FILE_NAME }} HEAD #push packages to the sleet feed (feed path is vnbuild global) - sleet push "{{ .PACK_OUT }}/debug/" --source debug --config "{{ .SLEET_CONFIG_PATH }}" --force - sleet push "{{ .PACK_OUT }}/release/" --source release --config "{{ .SLEET_CONFIG_PATH }}" --force #called by build pipeline to clean module clean: cmds: #clean solution - dotnet clean /p:BuildInParallel=true /p:MultiProcessorCompilation=true - cmd: powershell -Command "rm {{ .ARCHIVE_FILE_NAME }} --Force" ignore_error: true #Internal tasks build_debug: internal: true cmds: - dotnet publish -c debug {{ .MS_ARGS }} - dotnet pack -c debug {{ .MS_ARGS }} -o "{{ .PACK_OUT }}/debug/" build_release: internal: true cmds: - dotnet publish -c release {{ .MS_ARGS }} - dotnet pack -c release {{ .MS_ARGS }} -o "{{ .PACK_OUT }}/release/"