Skip to content

The Unified and Autonomous Development Platform

Edit .onedev-buildspec.yml

Robin Shenbfe3dac71679
diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml
index e9445707f6..2ffbd49095 100644
--- a/.onedev-buildspec.yml
+++ b/.onedev-buildspec.yml
@@ -80,22 +80,11 @@ jobs:
- 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.username=@job_token@ -Dmaven.deploy.password=@secrets:maven-deploy-password@ deploy -Pee
- ''
- - 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
+ - '# Prepare for artifact and site publish'
- cp server-product/target/onedev-${buildVersion}.zip .
- ''
- mkdir server-plugin-archetype-${buildVersion}
@@ -107,30 +96,6 @@ jobs:
- 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
@@ -139,14 +104,19 @@ jobs:
- sha256sum server-plugin-archetype-${buildVersion}.tar.gz > server-plugin-archetype-${buildVersion}.tar.gz.sha256
- ''
- cp server-product/target/docker/*.yaml .
+ - ''
+ - '# Prepare for docker image build'
+ - cd $projectDir/server-product/docker
+ - docker run --privileged --rm tonistiigi/binfmt --install all
+ - ./prepare.sh
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !PublishArtifactStep
- name: publish artifact
+ name: publish artifacts
artifacts: '*.zip *.tar.gz *.sha256 *.yaml'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !PublishMarkdownReportStep
- name: publish markdown report
+ name: publish incompatibility report
reportName: Incompatibilities
filePatterns: server-product/system/incompatibilities/**
startPage: server-product/system/incompatibilities/incompatibilities.md
@@ -170,7 +140,7 @@ jobs:
moreOptions: --builder onedev --platform linux/amd64,linux/arm64
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
- name: deploy
+ name: publish GH release
runInContainer: true
image: '@property:buildEnvironment@'
interpreter: !DefaultInterpreter
@@ -181,32 +151,6 @@ jobs:
- 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.username=@job_token@ -Dmaven.deploy.password=@secrets:maven-deploy-password@ deploy -Pee
- - ''
- - 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..."
- ''
@@ -231,22 +175,31 @@ jobs:
- 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
+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CloseMilestoneStep
name: close milestone
milestoneName: '@build_version@'
accessTokenSecret: onedev-token
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
+ - !CommandStep
+ name: publish helm chart
+ runInContainer: true
+ image: '@property:buildEnvironment@'
+ interpreter: !DefaultInterpreter
+ commands:
+ - set -e
+ - ''
+ - buildVersion=@build_version@
+ - projectDir=`pwd`
+ - ''
+ - cd $projectDir/server-product/helm
+ - ./prepare.sh
+ - ''
+ - cd $projectDir/server-product/target/helm-chart
+ - cloudsmith push helm onedev/onedev onedev-${buildVersion}.tgz -k @secret:cloudsmith-token@
+ useTTY: false
+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
jobDependencies:
- jobName: CI
requireSuccessful: true