From 6159b32f1abe05e92e2638c665d954958214b2f3 Mon Sep 17 00:00:00 2001 From: vnugent Date: Fri, 6 Sep 2024 21:22:46 -0400 Subject: add ftp as a publish source, cleanup and automatic builds --- .onedev-buildspec.yml | 41 ++++++++++++++++++++++++++++++++++++++++- Taskfile.yaml | 42 ++++++++++++++++++++++++++++++------------ 2 files changed, 70 insertions(+), 13 deletions(-) diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml index db67422..731aa49 100644 --- a/.onedev-buildspec.yml +++ b/.onedev-buildspec.yml @@ -1,4 +1,4 @@ -version: 33 +version: 35 jobs: - name: Push to GitHub steps: @@ -37,3 +37,42 @@ jobs: maxRetries: 3 retryDelay: 30 timeout: 3600 + +- name: Build and publish + jobExecutor: primary-shell-executor + steps: + - !CheckoutStep + name: Code checkout + cloneCredential: !DefaultCredential {} + withLfs: false + withSubmodules: false + checkoutPath: '@project_name@/' + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !CommandStep + name: VNBuild build + runInContainer: false + interpreter: !DefaultInterpreter + commands: | + vnbuild build -S --verbose + useTTY: true + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !CommandStep + name: VNBuild publish + runInContainer: false + interpreter: !DefaultInterpreter + commands: | + vnbuild publish --ftp "@secret:ftp_server_address@" --sign + envVars: + - name: FTP_USERNAME + value: '@secret:ftp_username@' + - name: FTP_PASSWORD + value: '@secret:ftp_password@' + useTTY: true + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + triggers: + - !BranchUpdateTrigger + branches: master + retryCondition: never + maxRetries: 3 + retryDelay: 30 + timeout: 3600 diff --git a/Taskfile.yaml b/Taskfile.yaml index 9333200..84da2d7 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -16,30 +16,48 @@ tasks: #pack up source code and put in output - powershell -Command "Get-ChildItem -Include *.cs,*.csproj -Recurse | Where { \$_.FullName -notlike '*\obj\*' } | Resolve-Path -Relative | tar --files-from - -czf '{{.TARGET}}/src.tgz'" - #run post in debug mode - - for: [ win-x64, linux-x64, osx-x64, linux-arm64, linux-arm ] - task: postbuild - vars: { BUILD_MODE: debug, TARGET_OS: '{{ .ITEM }}'} + #remove uncessary files from the release dir + - powershell -Command "Get-ChildItem -Recurse '{{ .RELEASE_DIR }}/' -Include *.pdb,*.xml | Remove-Item" - #remove uncessary files from the release dir - - powershell -Command "Get-ChildItem -Recurse '{{.RELEASE_DIR}}/' -Include *.pdb,*.xml | Remove-Item" + - task: posbuild_parallel + + posbuild_parallel: + deps: + - task: postbuild + vars: { BUILD_MODE: debug, TARGET_OS: win-x64 } + - task: postbuild + vars: { BUILD_MODE: debug, TARGET_OS: linux-x64 } + - task: postbuild + vars: { BUILD_MODE: debug, TARGET_OS: osx-x64 } + - task: postbuild + vars: { BUILD_MODE: debug, TARGET_OS: linux-arm } + - task: postbuild + vars: { BUILD_MODE: debug, TARGET_OS: linux-arm64 } + + - task: postbuild + vars: { BUILD_MODE: release, TARGET_OS: win-x64 } + - task: postbuild + vars: { BUILD_MODE: release, TARGET_OS: linux-x64 } + - task: postbuild + vars: { BUILD_MODE: release, TARGET_OS: osx-x64 } + - task: postbuild + vars: { BUILD_MODE: release, TARGET_OS: linux-arm } + - task: postbuild + vars: { BUILD_MODE: release, TARGET_OS: linux-arm64 } - - for: [ win-x64, linux-x64, osx-x64, linux-arm64, linux-arm ] - task: postbuild - vars: { BUILD_MODE: release, TARGET_OS: '{{ .ITEM }}'} postbuild: internal: true dir: '{{.USER_WORKING_DIR}}' vars: - BUILD_DIR: "{{.USER_WORKING_DIR}}/bin/{{.BUILD_MODE}}/{{.TARGET_FRAMEWORK}}/{{.TARGET_OS}}/publish" + BUILD_DIR: "{{ .USER_WORKING_DIR }}/bin/{{ .BUILD_MODE }}/{{ .TARGET_FRAMEWORK }}/{{ .TARGET_OS }}/publish" cmds: #copy and readme to target - - cmd: cd .. && powershell -Command "Copy-Item -Path ./build.readme.txt -Destination '{{.BUILD_DIR}}/readme.txt'" + - cmd: cd .. && powershell -Command "Copy-Item -Path ./build.readme.txt -Destination '{{ .BUILD_DIR }}/readme.txt'" ignore_error: true #tar outputs - - cd "{{.BUILD_DIR}}" && tar -czf "{{.TARGET}}/{{.TARGET_OS}}-{{.BUILD_MODE}}.tgz" . + - cd "{{ .BUILD_DIR }}" && tar -czf "{{ .TARGET }}/{{ .TARGET_OS }}-{{ .BUILD_MODE }}.tgz" . #Remove the output dirs on clean clean: -- cgit