edh-elo/.drone.yml
Jack Jackson 1c9aa30721 Add "Latest Score" in Decks view
Also experiment with auto-helm-update and caching, and make some updates
to seed data
2024-07-10 21:20:48 -07:00

66 lines
2.4 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
- name: Update Helm Chart
image: alpine
environment:
GITEA_PASSWORD:
from_secret: gitea_password
GITEA_PAT:
from_secret: gitea_pat
commands:
# Cannot use `drone/git` plugin because:
# * it cannot check out to a different directory
# * if you try to clear the main directory and use it to checkout, Drone will just re-clone the original repo
# between steps
# ...God, I really need to transition off of Drone and onto a better CI tool...
- find . -not -path '.' | xargs rm -rf
- find . -not -path '.'
- apk add yq git
- git clone https://scubbo:${GITEA_PASSWORD}@gitea.scubbo.org/scubbo/helm-charts.git
- cd helm-charts
- cat charts/edh-elo/values.yaml
- yq -i '.image.tag = "${DRONE_COMMIT_SHA:0:10}"' charts/edh-elo/values.yaml
- git add -A
- git -c user.name="Imagebot" -c user.email="fake@scubbo.org" commit -m 'Update EDH ELO commit to "${DRONE_COMMIT_SHA:0:10}"'
- git remote add origin-with-credentials "https://scubbo:$GITEA_PAT@gitea.scubbo.org/scubbo/helm-charts.git"
- git push origin-with-credentials main:main