zProtect/.onedev-buildspec.yml

70 lines
2.4 KiB
YAML

version: 15
jobs:
- name: Build
steps:
- !CheckoutStep
name: Checkout
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Detect Version
runInContainer: true
image: '@script:builtin:gradle:determine-docker-image@'
interpreter: !DefaultInterpreter
commands:
- echo "Detecting project version (may require some time while downloading gradle
dependencies)..."
- 'echo $(gradle properties | grep ^version: | grep -v unspecified | cut -c10-)
> buildVersion'
useTTY: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: Set Version
buildVersion: '@file:buildVersion@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Post Webhook
runInContainer: true
image: prontotools/alpine-git-curl
interpreter: !DefaultInterpreter
commands:
- user=$(git log --format=%an -n 1 @commit_hash@)
- commit_hash=@commit_hash@
- commit_message=$(git log --format=%B -n 1 @commit_hash@)
- 'curl -H ''Content-Type: application/json'' \'
- "\t-d \"{\\\"avatar_url\\\": \\\"https://test.it-snek.com/static/media/logo.c0ab911818705a32c78c.png\\\
\", \\\"username\\\": \\\"zGitBot\\\", \\\"embeds\\\": [{\\\"author\\\": {\\\
\"name\\\": \\\"${user}\\\"},\\\"title\\\": \\\"@project_name@/@branch@\\\"\
, \\\"description\\\": \\\"${commit_hash:0:7}: ${commit_message}\\\"}]}\"\
\ \\"
- "\t'https://discord.com/api/webhooks/904058376504348702/v7Otrf48So0S8g67YkH8Xnh6g7EN9T8grSuvY3IHGksjhP6V7AYb5FG0zKr33mtZSFmq'"
useTTY: false
condition: ALWAYS
- !CommandStep
name: Gradle Build
runInContainer: true
image: '@script:builtin:gradle:determine-docker-image@'
interpreter: !DefaultInterpreter
commands:
- gradle build --no-daemon
useTTY: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !PublishArtifactStep
name: Publish Artifact
artifacts: build/libs/*
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !BranchUpdateTrigger {}
- !PullRequestUpdateTrigger {}
retryCondition: never
maxRetries: 3
retryDelay: 30
cpuRequirement: 500
memoryRequirement: 256
caches:
- key: gradle-cache
path: /home/gradle/.gradle
timeout: 3600