diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..3b1a6a7 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,57 @@ +--- +kind: pipeline +type: kubernetes +name: build + +steps: + - name: build + image: mgoltzsche/podman:4.9.4 + privileged: true + environment: + REGISTRY_USERNAME: + from_secret: registry_username + REGISTRY_PASSWORD: + from_secret: registry_password + REGISTRY_SERVER: "docker.io" + RELEASE_IMAGE_NAME: "docker.io/genunix/restic" + commands: + - | + RESTIC_VERSION=$$(grep RESTIC_VERSION Dockerfile|cut -d = -f 2) + podman login --username "$${REGISTRY_USERNAME}" --password "$${REGISTRY_PASSWORD}" "$${REGISTRY_SERVER}" + echo "== Building $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA}" + podman build --platform linux/arm64/v8 --platform linux/amd64 --pull-always --format docker -t $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} . + echo "== Publishing $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA}" + podman push $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} docker://$${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} + podman push $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} docker://$${RELEASE_IMAGE_NAME}:$${HASS_VERSION} + podman logout "$${REGISTRY_SERVER}" + volumes: + - name: containers + path: /var/lib/containers + when: + branch: + - master + + - name: cleanup + image: mgoltzsche/podman:4.9.4 + privileged: true + environment: + RELEASE_IMAGE_NAME: "docker.io/genunix/restic" + commands: + - podman rmi -f $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} + - podman image prune -f + volumes: + - name: containers + path: /var/lib/containers + when: + branch: + - master + +trigger: + event: + - push + - custom + +volumes: + - name: containers + host: + path: /var/lib/containers