mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 11:51:02 +00:00
Fix version.json
updates (#3057)
closes #3038 closes #2748 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
This commit is contained in:
parent
857db91634
commit
9ea4b6af39
1 changed files with 87 additions and 28 deletions
|
@ -1,8 +1,8 @@
|
|||
when:
|
||||
- event: tag
|
||||
- event: pull_request
|
||||
- event: push
|
||||
path: &when_path
|
||||
variables:
|
||||
- &golang_image 'docker.io/golang:1.21.5'
|
||||
- &node_image 'docker.io/node:21-alpine'
|
||||
- &alpine_image 'docker.io/alpine:3.19'
|
||||
- path: &when_path
|
||||
- 'docs/**'
|
||||
- '.woodpecker/docs.yml'
|
||||
# since we generate docs for cli tool we have to watch this too
|
||||
|
@ -10,20 +10,33 @@ when:
|
|||
- 'cmd/cli/**'
|
||||
# api docs
|
||||
- 'server/api/**'
|
||||
- path: &docker_path # web source code
|
||||
- 'web/**'
|
||||
# api source code
|
||||
- 'server/api/**'
|
||||
# go source code
|
||||
- '**/*.go'
|
||||
- 'go.*'
|
||||
# schema changes
|
||||
- 'pipeline/schema/**'
|
||||
# Dockerfile changes
|
||||
- 'docker/**'
|
||||
|
||||
when:
|
||||
- event: tag
|
||||
- event: pull_request
|
||||
- event: push
|
||||
path:
|
||||
- <<: *when_path
|
||||
- <<: *docker_path
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
- renovate/*
|
||||
- event: pull_request_closed
|
||||
path: *when_path
|
||||
- cron: update_docs
|
||||
event: cron
|
||||
- event: manual
|
||||
evaluate: 'TASK == "docs"'
|
||||
|
||||
variables:
|
||||
- &golang_image 'docker.io/golang:1.21.5'
|
||||
- &node_image 'docker.io/node:21-alpine'
|
||||
|
||||
steps:
|
||||
build-cli:
|
||||
image: *golang_image
|
||||
|
@ -31,7 +44,7 @@ steps:
|
|||
- make docs
|
||||
when:
|
||||
- path: *when_path
|
||||
- event: [cron, manual]
|
||||
- event: manual
|
||||
|
||||
build:
|
||||
image: *node_image
|
||||
|
@ -42,7 +55,7 @@ steps:
|
|||
- pnpm build
|
||||
when:
|
||||
- path: *when_path
|
||||
- event: [cron, manual]
|
||||
- event: manual
|
||||
|
||||
deploy-preview:
|
||||
image: docker.io/woodpeckerci/plugin-surge-preview:1.3.0
|
||||
|
@ -57,26 +70,70 @@ steps:
|
|||
event: [pull_request, pull_request_closed]
|
||||
path: *when_path
|
||||
|
||||
deploy:
|
||||
image: docker.io/alpine:3.19
|
||||
deploy-prepare:
|
||||
image: *alpine_image
|
||||
secrets:
|
||||
- BOT_PRIVATE_KEY
|
||||
commands:
|
||||
- apk add openssh-client git rsync jq
|
||||
- apk add openssh-client git
|
||||
- mkdir -p $HOME/.ssh
|
||||
- ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
|
||||
- echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
|
||||
- chmod 0600 $HOME/.ssh/id_rsa
|
||||
- git config --global user.email "woodpecker-bot@obermui.de"
|
||||
- git config --global user.name "woodpecker-bot"
|
||||
- git clone --depth 1 --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
|
||||
# update latest and next version
|
||||
- if [[ "$CI_PIPELINE_EVENT" == "tag" && "${CI_COMMIT_TAG}" != *"rc"* ]] ; then jq '.latest = "${CI_COMMIT_TAG}"' /repo/version.json > /repo/version.json.tmp && mv /repo/version.json.tmp /repo/version.json ; fi
|
||||
- if [[ "$CI_PIPELINE_EVENT" == "tag" ]] ; then jq '.rc = "${CI_COMMIT_TAG}"' /repo/version.json > /repo/version.json.tmp && mv /repo/version.json.tmp /repo/version.json ; fi
|
||||
- if [ "$CI_PIPELINE_EVENT" == "push" ] ; then jq '.next = "next-${CI_COMMIT_SHA:0:10}"' /repo/version.json > /repo/version.json.tmp && mv /repo/version.json.tmp /repo/version.json ; fi
|
||||
# copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
|
||||
- rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --exclude version.json --delete docs/build/ /repo
|
||||
- cd /repo
|
||||
- git clone --depth 1 --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git ./docs_repo
|
||||
when:
|
||||
- event: push
|
||||
path:
|
||||
- <<: *when_path
|
||||
- <<: *docker_path
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: [manual, tag]
|
||||
|
||||
# update latest and next version
|
||||
version-next:
|
||||
image: *alpine_image
|
||||
commands:
|
||||
- apk add jq
|
||||
- jq '.next = "next-${CI_COMMIT_SHA:0:10}"' ./docs_repo/version.json > ./docs_repo/version.json.tmp
|
||||
- mv ./docs_repo/version.json.tmp ./docs_repo/version.json
|
||||
when:
|
||||
- event: push
|
||||
path: *docker_path
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
version-release:
|
||||
image: *alpine_image
|
||||
commands:
|
||||
- apk add jq
|
||||
- if [[ "${CI_COMMIT_TAG}" != *"rc"* ]] ; then jq '.latest = "${CI_COMMIT_TAG}"' ./docs_repo/version.json > ./docs_repo/version.json.tmp && mv ./docs_repo/version.json.tmp ./docs_repo/version.json ; fi
|
||||
- jq '.rc = "${CI_COMMIT_TAG}"' ./docs_repo/version.json > ./docs_repo/version.json.tmp
|
||||
- mv ./docs_repo/version.json.tmp ./docs_repo/version.json
|
||||
when:
|
||||
- event: tag
|
||||
|
||||
copy-files:
|
||||
image: *alpine_image
|
||||
commands:
|
||||
- apk add rsync
|
||||
# copy all docs files and delete all old ones, but leave CNAME, index.yaml and version.json untouched
|
||||
- rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --exclude version.json --delete docs/build/ ./docs_repo
|
||||
when:
|
||||
- event: push
|
||||
path: *when_path
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: manual
|
||||
|
||||
deploy:
|
||||
image: *alpine_image
|
||||
secrets:
|
||||
- BOT_PRIVATE_KEY
|
||||
commands:
|
||||
- apk add openssh-client rsync git
|
||||
- mkdir -p $HOME/.ssh
|
||||
- ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
|
||||
- echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
|
||||
- chmod 0600 $HOME/.ssh/id_rsa
|
||||
- cd ./docs_repo
|
||||
- git add .
|
||||
# exit successfully if nothing changed
|
||||
- test -n "$(git status --porcelain)" || exit 0
|
||||
|
@ -84,6 +141,8 @@ steps:
|
|||
- git push
|
||||
when:
|
||||
- event: push
|
||||
path: *when_path
|
||||
path:
|
||||
- <<: *when_path
|
||||
- <<: *docker_path
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: [cron, manual, tag]
|
||||
- event: [manual, tag]
|
||||
|
|
Loading…
Reference in a new issue