Files
eleith 9fa12c7275
ci/woodpecker/pr/build-docker Pipeline was successful
ci: build branch-tagged images for pull requests
2026-09-30 17:56:51 -07:00

128 lines
3.2 KiB
YAML

workspace:
base: /workspace
path: app
when:
- event: push
branch: main
path:
include:
- "**/*.go"
- "**/*.gohtml"
- "go.mod"
- "go.sum"
- ".golangci.yml"
- "scripts/check-coverage.sh"
- "bin/generate-encrypted-token.sh"
- ".woodpecker/build-docker.yml"
- "Dockerfile"
exclude:
- "**/*.md"
on_empty: true
- event: pull_request
- event: tag
ref: "refs/tags/v*.*.*"
steps:
vendor:
image: golang:1.24.5-alpine
commands:
- go mod vendor
lint:
image: golang:1.24.5-alpine
commands:
- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.3.0
- golangci-lint run -v
test:
image: golang:1.24.5-alpine
commands:
- ./scripts/check-coverage.sh 60
extract-semver-tags:
image: alpine/git:latest
commands:
- |
VERSION_FULL="${CI_COMMIT_TAG#v}"
VERSION_MAJOR=$(echo "$VERSION_FULL" | cut -d. -f1)
VERSION_MINOR=$(echo "$VERSION_FULL" | cut -d. -f2)
SEMVER_FULL="$VERSION_FULL"
SEMVER_MAJOR_MINOR="$VERSION_MAJOR.$VERSION_MINOR"
SEMVER_MAJOR="$VERSION_MAJOR"
echo "Extracted versions: $SEMVER_FULL, $SEMVER_MAJOR_MINOR, $SEMVER_MAJOR, "
echo -e "$SEMVER_FULL\n$SEMVER_MAJOR\n$SEMVER_MAJOR_MINOR" >> .tags
cat .tags
when:
- event: tag
extract-pr-tag:
image: alpine:3.22
commands:
- |
branch_slug=$(printf '%s' "$CI_COMMIT_SOURCE_BRANCH" | sed 's/[^A-Za-z0-9_.-]/-/g' | cut -c1-96)
printf 'pr-%s-%s\n' "$CI_COMMIT_PULL_REQUEST" "$branch_slug" > .tags
cat .tags
when:
- event: pull_request
build-docker-pr:
image: woodpeckerci/plugin-docker-buildx:6.0.3
settings:
repo: git.eleith.com/eleith.private/readeckobo
username: eleith
dockerfile: Dockerfile
registry: https://git.eleith.com
password:
from_secret: gitea_docker_registry
tags_file: .tags
when:
- event: pull_request
build-docker-main:
image: woodpeckerci/plugin-docker-buildx:6.0.3
settings:
repo: git.eleith.com/eleith.private/readeckobo
username: eleith
dockerfile: Dockerfile
registry: https://git.eleith.com
password:
from_secret: gitea_docker_registry
tags:
- latest
when:
- event: push
branch: main
build-docker-tag:
image: woodpeckerci/plugin-docker-buildx:6.0.3
settings:
repo: git.eleith.com/eleith.private/readeckobo
username: eleith
dockerfile: Dockerfile
registry: https://git.eleith.com
password:
from_secret: gitea_docker_registry
tags_file: .tags
when:
- event: tag
ref: "refs/tags/v*.*.*"
notify:
image: deblan/woodpecker-email:3.3.0
settings:
dsn:
from_secret: woodpecker_email_dsn
from:
address:
from_secret: woodpecker_email_from_address
name:
from_secret: woodpecker_email_from_name
recipients:
from_secret: woodpecker_email_recipient
recipients_only: true
when:
- event: push
branch: main
status: [failure, success]