1 Star 0 Fork 18

liubuzhou/OneDev

forked from Gitee 极速下载/OneDev 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.onedev-buildspec.yml 7.62 KB
一键复制 编辑 原始数据 按行查看 历史
robinshine 提交于 2023-08-18 22:45 . Add EE module
version: 25
jobs:
- name: CI
steps:
- !CheckoutStep
name: checkout
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: true
cloneDepth: 1
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: detect build version
runInContainer: true
image: '@property:buildEnvironment@'
interpreter: !DefaultInterpreter
commands:
- set -e
- echo "Detecting project version (may require some time while downloading maven dependencies)..."
- echo $(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout) > buildVersion
useTTY: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: set build version
buildVersion: '@file:buildVersion@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: test
runInContainer: true
image: '@property:buildEnvironment@'
interpreter: !DefaultInterpreter
commands:
- mvn test
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !BranchUpdateTrigger
branches: main
projects: onedev/server
retryCondition: never
maxRetries: 3
retryDelay: 30
caches:
- key: maven-cache
path: /root/.m2/repository
timeout: 3600
- name: Release
steps:
- !CheckoutStep
name: checkout
cloneCredential: !HttpCredential
accessTokenSecret: onedev-token
withLfs: false
withSubmodules: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: detect build version
runInContainer: true
image: '@property:buildEnvironment@'
interpreter: !DefaultInterpreter
commands:
- set -e
- echo "Detecting project version (may require some time while downloading maven dependencies)..."
- echo $(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout) > buildVersion
useTTY: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: set build version
buildVersion: '@file:buildVersion@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: build & deploy
runInContainer: true
image: '@property:buildEnvironment@'
interpreter: !DefaultInterpreter
commands:
- set -e
- set -o pipefail
- ''
- buildVersion=@build_version@
- ''
- projectDir=`pwd`
- docker login -u robinshen -p @secrets:dockerhub-password@
- ''
- '# Skip test as we''ve already tested in CI build'
- mvn -Dmaven.test.skip=true -Dmaven.deploy.password=@secrets:maven-deploy-password@ deploy
- ''
- cd $projectDir/server-product/docker
- docker run --privileged --rm tonistiigi/binfmt --install all
- ./build.sh release
- ''
- cd $projectDir/server-product/helm
- ./build.sh
- ''
- cd $projectDir/server-product/target/helm-chart
- cloudsmith push helm onedev/onedev onedev-${buildVersion}.tgz -k @secret:cloudsmith-token@
- ''
- cd $projectDir
- cp server-product/target/onedev-${buildVersion}.zip .
- ''
- mkdir server-plugin-archetype-${buildVersion}
- cd server-plugin/server-plugin-archetype
- mvn help:effective-pom -Doutput=$projectDir/server-plugin-archetype-${buildVersion}/pom.xml
- cd $projectDir
- sed -i 's/\/onedev-build\/workspace\/server-plugin\/server-plugin-archetype\///' server-plugin-archetype-${buildVersion}/pom.xml
- cp -r server-plugin/server-plugin-archetype/src server-plugin-archetype-${buildVersion}
- zip -r server-plugin-archetype-${buildVersion}.zip server-plugin-archetype-${buildVersion}
- tar zcvf server-plugin-archetype-${buildVersion}.tar.gz server-plugin-archetype-${buildVersion}
- ''
- echo "Creating release tag..."
- ''
- git config --global user.name "Robin Shen"
- git config --global user.email "robin@@onedev.io"
- git config --global --add safe.directory /onedev-build/workspace
- ''
- git tag v$buildVersion -m "Release tag"
- git push -f origin v$buildVersion:v$buildVersion
- git config --global --unset http.extraHeader
- git push -f https://robin:@secrets:github-token@@@github.com/theonedev/onedev v$buildVersion:v$buildVersion
- ''
- echo "Creating release in GitHub..."
- ''
- releaseId=$(curl -u robinshine:@secrets:github-token@ https://api.github.com/repos/theonedev/onedev/releases/tags/v$buildVersion | jq '.id')
- ''
- releaseJson="{\"name\":\"$buildVersion\",\"tag_name\":\"v$buildVersion\",\"body\":\"## Installation Guide\n\nhttps://docs.onedev.io/category/installation-guide\n\n## Change Log\n\nhttps://code.onedev.io/onedev/server/~builds/@build_number@/fixed-issues?query=%22State%22+is+%22Released%22+order+by+%22Type%22+asc+and+%22Priority%22+desc\n\n## Incompatibilities\n\nhttps://code.onedev.io/onedev/server/~builds/@build_number@/markdown/Incompatibilities/server-product/system/incompatibilities/incompatibilities.md\"}"
- ''
- 'acceptHeader="Accept: application/vnd.github.v3+json"'
- if [ "$releaseId" == "null" ]; then
- ' curl -u robinshine:@secrets:github-token@ -X POST -H "$acceptHeader" -d "$releaseJson" https://api.github.com/repos/theonedev/onedev/releases'
- else
- ' curl -u robinshine:@secrets:github-token@ -X PATCH -H "$acceptHeader" -d "$releaseJson" https://api.github.com/repos/theonedev/onedev/releases/$releaseId'
- fi
- ''
- unzip onedev-${buildVersion}.zip
- tar zcvf onedev-${buildVersion}.tar.gz onedev-${buildVersion}
- sha256sum onedev-${buildVersion}.zip > onedev-${buildVersion}.zip.sha256
- sha256sum onedev-${buildVersion}.tar.gz > onedev-${buildVersion}.tar.gz.sha256
- sha256sum server-plugin-archetype-${buildVersion}.zip > server-plugin-archetype-${buildVersion}.zip.sha256
- sha256sum server-plugin-archetype-${buildVersion}.tar.gz > server-plugin-archetype-${buildVersion}.tar.gz.sha256
- ''
- cp server-product/target/docker/*.yaml .
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !PublishArtifactStep
name: publish artifact
artifacts: '*.zip *.tar.gz *.sha256 *.yaml'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !PublishMarkdownReportStep
name: publish markdown report
reportName: Incompatibilities
filePatterns: server-product/system/incompatibilities/**
startPage: server-product/system/incompatibilities/incompatibilities.md
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CloseMilestoneStep
name: close milestone
milestoneName: '@build_version@'
accessTokenSecret: onedev-token
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
jobDependencies:
- jobName: CI
requireSuccessful: true
retryCondition: never
maxRetries: 3
retryDelay: 30
caches:
- key: maven-cache
path: /root/.m2/repository
timeout: 3600
- name: Sync Main (GitHub)
steps:
- !CheckoutStep
name: 'checkout '
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: sync
runInContainer: true
image: alpine/git:1.0.7
interpreter: !DefaultInterpreter
commands:
- git config --global --unset http.extraHeader
- git push -f https://robinshine:@secrets:github-token@@@github.com/theonedev/onedev.git HEAD:main
useTTY: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !BranchUpdateTrigger
branches: main
projects: onedev/server
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 3600
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/liu-buzhou/OneDev.git
[email protected]:liu-buzhou/OneDev.git
liu-buzhou
OneDev
OneDev
main

搜索帮助