Files
installer-tool/.drone.yml
gyurix 43efebecc3
All checks were successful
continuous-integration/drone/push Build is passing
added install sh push to local-install repo
2024-06-13 16:37:34 +02:00

59 lines
1.5 KiB
YAML

kind: pipeline
name: default
trigger:
branch:
- master
event:
- push
workspace:
path: /drone/src
environment:
IMAGE_NAME: installer-tool
DOCKER_REGISTRY_URL: registry.format.hu
steps:
- name: build demo image
image: plugins/docker
commands:
- cd /drone/src/
- docker build -t $${DOCKER_REGISTRY_URL}/$${IMAGE_NAME} -f Dockerfile .
- docker push $${DOCKER_REGISTRY_URL}/$${IMAGE_NAME}
when:
branch:
- master
volumes:
- name: docker
path: /var/run/docker.sock
- name: update public installer repository
image: alpine:latest
environment:
TOKEN:
from_secret: TOKEN
GIT_URL: https://git.format.hu
REPO: public/local-install
FILE_PATH: install.sh
commands:
- apk --update add curl jq
- URL="$GIT_URL/api/v1/repos/$REPO/contents/$FILE_PATH"
- |
SHA=$(curl -s -H "Authorization: token $TOKEN" -H "Accept: application/json" $URL | jq -r '.sha')
ZONE=$(cat /drone/src/install.sh | base64 -w0)
DATA=$(printf '{"message": "Modifying install.sh", "sha": "'$SHA'", "content": "%s", "branch": "main"}' "$ZONE")
curl -X PUT -s -H "Authorization: token $TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" -d "$DATA" $URL
echo $ZONE
when:
branch:
- master
volumes:
- name: docker
path: /var/run/docker.sock
volumes:
- name: docker
host:
path: /var/run/docker.sock