# https://taskfile.dev #Called by the vnbuild system to produce builds for my website #https://www.vaughnnugent.com/resources/software #This taskfile is called from the root of a project that is being built #and the purpose of this taskfile is to package up the output of a build #from the solution file, and package it up into a tgz files for distribution version: '3' vars: BINARY_DIR: 'bin' RELEASE_DIR: "./bin/release/{{.TARGET_FRAMEWORK}}/publish" TARGET_DIR: '{{ .USER_WORKING_DIR }}/{{ .BINARY_DIR }}' tasks: #when build succeeds, archive the output into a tgz postbuild_success: dir: '{{.USER_WORKING_DIR}}' cmds: #remove uncessary files from the release dir - powershell -Command "Get-ChildItem -Recurse '{{.RELEASE_DIR}}/' -Include *.pdb,*.xml | Remove-Item" - task: post_parallel post_parallel: internal: true deps: - task: packsource - task: postbuild vars: { BUILD_MODE: debug } - task: postbuild vars: { BUILD_MODE: release } postbuild: dir: '{{.USER_WORKING_DIR}}' internal: true vars: #the build output directory BUILD_OUT: "{{ .BINARY_DIR }}/{{ .BUILD_MODE }}/{{ .TARGET_FRAMEWORK }}/publish" cmds: - powershell cp ../build.readme.txt '{{.BUILD_OUT}}/readme.txt' #tar outputs - cd "{{ .BUILD_OUT }}" && tar -czf "{{ .TARGET_DIR }}/{{ .BUILD_MODE }}.tgz" . packsource: dir: '{{.USER_WORKING_DIR}}' internal: true cmds: #copy source code to target - powershell -Command "Get-ChildItem -Include *.cs,*.csproj -Recurse | Where { \$_.FullName -notlike '*\obj\*' -and \$_.FullName -notlike '*\bin\*' } | Resolve-Path -Relative | tar --files-from - -czf '{{ .TARGET_DIR }}/src.tgz'" #Remove the output dirs on clean clean: dir: '{{.USER_WORKING_DIR}}' ignore_error: true cmds: - for: [ bin/, obj/ ] cmd: powershell -Command "rm -Recurse -Force '{{.ITEM}}'"