diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml index baa5825..c2850e9 100644 --- a/.onedev-buildspec.yml +++ b/.onedev-buildspec.yml @@ -13,6 +13,7 @@ jobs: triggers: - type: BranchUpdateTrigger branches: main + paths: -.onedev-buildspec.yml userMatch: anyone projects: OpenEngine - type: TagCreateTrigger @@ -24,15 +25,6 @@ jobs: timeout: 14400 - name: Compile for Linux steps: - - type: SetupCacheStep - name: conan-cache - key: conan-cache-@file:conanfile.py@ - paths: - - /root/.conan2 - uploadStrategy: UPLOAD_IF_CHANGED - changeDetectionExcludes: /root/.conan2/p/*/dl /root/.conan2/logs - condition: SUCCESSFUL - optional: true - type: CheckoutStep name: Checkout cloneCredential: @@ -41,6 +33,17 @@ jobs: withSubmodules: false condition: SUCCESSFUL optional: false + - type: SetupCacheStep + name: conan-cache + key: conan-cache-@file:./conanfile.txt@ + loadKeys: + - conan-cache-@project_name@ + paths: + - /root/.conan2 + uploadStrategy: UPLOAD_IF_NOT_HIT + changeDetectionExcludes: /root/.conan2/p/*/dl /root/.conan2/logs + condition: SUCCESSFUL + optional: true - type: CommandStep name: Compile for Linux runInContainer: true @@ -48,6 +51,12 @@ jobs: interpreter: type: DefaultInterpreter commands: | + #git clone --depth 1 https://github.com/dotnet/runtime.git + #cd runtime + #./build.sh -c Release -subset host + + #cp artifacts/bin/native/net10.0-linux-Release-x64/nethost/libnethost.a /onedev-build/workspace/lib/ + git submodule update --init --recursive conan profile detect --force @@ -74,6 +83,57 @@ jobs: condition: SUCCESSFUL optional: false jobExecutor: luna-executor + triggers: + - type: BranchUpdateTrigger + branches: main + paths: -.onedev-buildspec.yml + userMatch: anyone + projects: OpenEngine + retryCondition: never + maxRetries: 3 + retryDelay: 30 + timeout: 14400 +- name: Release to Gitea + steps: + - type: CommandStep + name: Release to Gitea + runInContainer: true + image: erriss/erris-build_tools:V0.8 + interpreter: + type: DefaultInterpreter + commands: | + # 1. Create the Release metadata + RELEASE_JSON=$(printf '{"tag_name":"v0.0.%s","target_commitish":"main","name":"Release v0.0.%s","body":"Automated build from OneDev","draft":false,"prerelease":false}' "$ONEDEV_BUILD_NUMBER" "$ONEDEV_BUILD_NUMBER") + + curl -X 'POST' \ + "https://gitea.anfer.fr/api/v1/repos/anfer/OpenEngine/releases" \ + -H "Authorization: token @secret:Gitea@" \ + -H "Content-Type: application/json" \ + -d "$RELEASE_JSON" > release_info.json + + # 2. Extract the Release ID (using jq) + RELEASE_ID=$(jq '.id' release_info.json) + + # 3. Upload your binary (oe_editor) + curl -X 'POST' \ + "https://gitea.anfer.fr/api/v1/repos/anfer/OpenEngine/releases/$RELEASE_ID/assets?name=oe_editor" \ + -H "Authorization: token @secret:Gitea@" \ + -H "Content-Type: multipart/form-data" \ + -F attachment=@@editor/oe_editor + envVars: + - name: ONEDEV_BUILD_NUMBER + value: '1' + useTTY: true + condition: SUCCESSFUL + optional: false + jobExecutor: terra-executor + triggers: + - type: DependencyFinishedTrigger + projects: OpenEngine + jobDependencies: + - jobName: Compile for Linux + requireSuccessful: true + artifacts: '**' retryCondition: never maxRetries: 3 retryDelay: 30