TeaWeb/.woodpecker/base.yaml

90 lines
2.1 KiB
YAML

when:
event: [push, deployment, manual, cron]
labels:
platform: linux/amd64
variables:
- &node_image 'node:14-bullseye'
- &buildx_image 'woodpeckerci/plugin-docker-buildx:2.2.1'
- &platforms 'linux/amd64'
- &dockerfile 'docker/Dockerfile.ci'
steps:
prepare-npm:
image: *node_image
secrets:
- npmconf
commands:
- git config --add safe.directory '*'
- if [ "$${NPMCONF:-}" != "" ]; then echo "$${NPMCONF}" >> "$${HOME}/.npmrc"; fi
- npm ci
- npx browserslist@latest --update-db
build-npm:
image: *node_image
commands:
- bash ./scripts/build.sh web dev
build-docker-next:
image: *buildx_image
pull: true
settings:
platforms: *platforms
dockerfile: *dockerfile
context: .
registry:
from_secret: registry_domain
repo:
from_secret: target_image_name
password:
from_secret: registry_token
username:
from_secret: registry_user
auto_tag: true
tag: [next, "next-${CI_COMMIT_SHA:0:8}"]
when:
branch: ${CI_REPO_DEFAULT_BRANCH}
event: push
build-docker-branch:
image: *buildx_image
pull: true
settings:
platforms: *platforms
dockerfile: *dockerfile
context: .
registry:
from_secret: registry_domain
repo:
from_secret: target_image_name
password:
from_secret: registry_token
username:
from_secret: registry_user
auto_tag: true
tag: ["${CI_COMMIT_BRANCH}", "${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}"]
when:
event: [push, manual]
build-docker-tag:
image: *buildx_image
pull: true
settings:
platforms: *platforms
dockerfile: *dockerfile
context: .
registry:
from_secret: registry_domain
repo:
from_secret: target_image_name
password:
from_secret: registry_token
username:
from_secret: registry_user
auto_tag: true
tag: [latest, "${CI_COMMIT_TAG}", "tag-${CI_COMMIT_SHA:0:8}"]
when:
event: [tag]