edh-elo/.drone.yml

66 lines
2.2 KiB
YAML

kind: pipeline
name: build-and-deploy
type: docker
platform:
os: linux
arch: arm64
steps:
- name: docker-build-and-push
image: thegeeklab/drone-docker-buildx # Absurd that this isn't offered as first-party!
privileged: true
settings:
# Consider testing with this if the cache-to arguments don't help!
# args:
# - BUILDKIT_INLINE_CACHE=1
cache_from:
- "gitea.scubbo.org/${DRONE_REPO}:${DRONE_BRANCH}"
cache_to:
# https://docs.docker.com/build/cache/backends/registry/
# `mode=max` necessary in order to cache intermediate stages
#
# https://github.com/go-gitea/gitea/issues/28973#issuecomment-1961859655
# Some parameters are necessary in order to make the push to gitea succeed
#
# Another reference:
# https://github.com/thegeeklab/drone-docker-buildx/issues/47
- "type=registry,ref=gitea.scubbo.org/${DRONE_REPO}:${DRONE_BRANCH},mode=max,image-manifest=true,oci-mediatypes=true"
registry: gitea.scubbo.org
username: scubbo
password:
from_secret: gitea_password
repo: gitea.scubbo.org/${DRONE_REPO}
tags:
- ${DRONE_BRANCH}
- ${DRONE_COMMIT_SHA:0:10}
target: prod
platforms:
- linux/arm64
- linux/amd64
# Because `drone/git` does not support checking out to a specified directory
# (https://github.com/drone/drone-git/blob/master/posix/clone-commit), we have to remove the current contents of the
# directory before cloning the Helm Chart repo or there will be a clash.
#
# ...God, I really need to transition off of Drone and onto a better CI tool...
- name: Clear directory
image: alpine
commands:
- rm -rf ./{*,.[!.]*,..?*}
- name: Checkout Helm Chart
image: drone/git
settings:
remote: gitea.scubbo.org/scubbo/helm-charts
ref: refs/heads/main
- name: Update Helm Chart
image: alpine
commands:
- apk add yq git
- cd helm-charts
- yq -i '.image.tag = "${DRONE_COMMIT_SHA:0:10}"' charts/edh-elo/values.yaml
- git add -A
- git commit -m "Update EDH ELO commit to "${DRONE_COMMIT_SHA:0:10}"
- git push