forgejo/.woodpecker/release-version.yml
Gapodo 3fd0bc95c4
Some checks failed
ci/woodpecker/push/compliance-and-tests Pipeline is pending
ci/woodpecker/push/release-version Pipeline is pending
ci/woodpecker/tag/compliance-and-tests Pipeline was successful
ci/woodpecker/tag/release-version Pipeline failed
another one
2022-12-05 02:47:12 +01:00

150 lines
4.4 KiB
YAML

platform: linux/amd64
depends_on:
- compliance-and-tests
workspace:
base: /source
path: /
variables:
- &golang_image 'golang:1.19'
- &node_image 'node:18'
- &xgo_image 'techknowlogick/xgo:go-1.19.x'
- &buildx_plugin_image 'woodpeckerci/plugin-docker-buildx'
- &gpgsign_plugin_image 'plugins/gpgsign:1'
# Docker and XGO platforms may vary in name (arm/v6/v7,...), please make sure,
# that all platforms listed in docker_platforms are also in make_platforms
# for the mapping look at docker/map-binaries.sh
#- &make_platforms 'linux/amd64,linux/arm64'
#- &docker_platforms 'linux/amd64,linux/arm64'
- &make_platforms 'linux/amd64'
- &docker_platforms 'linux/amd64'
pipeline:
fetch-tags:
image: docker:git
pull: true
commands:
- git config --add safe.directory '*'
- git fetch --tags --force
deps-frontend:
image: *node_image
pull: true
commands:
- make deps-frontend
deps-backend:
image: *golang_image
pull: true
commands:
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
- make deps-backend
secrets:
- goproxy_override
build-static:
image: *xgo_image
pull: true
commands:
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
- export WS_BASE="$(pwd)"
- echo "installing nodejs"
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
- echo "installing xz"
- apt-get install -qqy xz
- echo "fetching upx-v$${UPXVERSION}"
- cd /usr/local/bin
- curl -sL https://github.com/upx/upx/releases/download/v$${UPXVERSION}/upx-$${UPXVERSION}-amd64_linux.tar.xz | tar --strip-components 1 -xJf - upx-$${UPXVERSION}-amd64_linux/upx
- echo "checking upx"
- test -f /usr/local/bin/upx || exit 1
- export PATH=$PATH:$GOPATH/bin
- echo "building forgejo"
- cd $WS_BASE
- make CI=true LINUX_ARCHS=$${LINUX_ARCHS} release
- echo "building environment-to-ini"
- cd $WS_BASE/contrib/environment-to-ini
- make CI=true LINUX_ARCHS=$${LINUX_ARCHS} release
environment:
TAGS: bindata sqlite sqlite_unlock_notify
DEBIAN_FRONTEND: noninteractive
UPXVERSION: 4.0.1
LINUX_ARCHS: *make_platforms
secrets:
- goproxy_override
# prep-multiarch-binaries:
# image: *golang_image # image reuse to reduce pull times, go not required
# pull: true
# environment:
# defaulttagname: main # the fallback version used by make
# commands:
# - mkdir docker/bin
# - ./docker/map-binaries.sh ./dist/binaries forgejo ${CI_COMMIT_TAG##v}
# - ./docker/map-binaries.sh ./dist/contrib environment-to-ini ${CI_COMMIT_TAG##v}
# when:
# event: tag
debug:
image: *golang_image # image reuse to reduce pull times, go not required
pull: true
commands:
- pwd
- ls
- test -d dist && ls dist
when:
event: tag
build-docker:
image: *buildx_plugin_image
pull: true
environment:
defaulttagname: main
settings:
dockerfile: Dockerfile.ci
no_cache: true
platforms: *docker_platforms
registry:
from_secret: domain
tag: ${CI_COMMIT_TAG##v}
repo: ${CI_REPO_LINK##https://}
build_args_from_env:
- CI_COMMIT_TAG
- DEFAULTTAGNAME
password:
from_secret: releaseteamtoken
username:
from_secret: releaseteamuser
when:
event: tag
gpg-sign:
image: *gpgsign_plugin_image
pull: true
settings:
detach_sign: true
excludes:
- "dist/release/*.sha256"
files:
- "dist/release/*"
key:
from_secret: releaseteamgpg
when:
event: tag
release:
image: *golang_image
commands:
- curl -sL https://dl.gitea.io/tea/0.9.0/tea-0.9.0-linux-amd64 > /bin/tea && chmod +x /bin/tea
- REMOTE=$(echo $CI_REPO_LINK | sed -e 's|.*://||' -e 's|/.*||')
- GITEA_SERVER_URL=$CI_REPO_LINK GITEA_SERVER_TOKEN=$RELEASETEAMTOKEN tea login add --name $RELEASETEAMUSER --url $REMOTE
- ASSETS=$(ls dist/release/* | sed -e 's/^/-a /')
- echo "$${CI_COMMIT_TAG##v}" | grep -qi '-rc' && export RELEASETYPE="--prerelease"
- echo "$${CI_COMMIT_TAG##v}" | grep -qi '-dev' && export RELEASETYPE="--draft"
- tea release create $ASSETS --tag $CI_COMMIT_TAG --title $CI_COMMIT_TAG $${RELEASETYPE}
when:
event: tag
secrets:
- releaseteamtoken
- releaseteamuser