repo/.drone.yml

73 lines
1.8 KiB
YAML

kind: pipeline
name: default
type: docker
platform:
os: linux
arch: arm64
clone:
disable: true
steps:
- name: clone
image: alpine/git
environment:
SSH_KEY:
from_secret: private_ssh_key
commands:
- mkdir $HOME/.ssh
- echo "$SSH_KEY" > $HOME/.ssh/id_ed25519
- chmod 600 $HOME/.ssh/id_ed25519
- touch $HOME/.ssh/known_hosts
- chmod 600 $HOME/.ssh/known_hosts
- ssh-keyscan -H git.2martens.de > $HOME/.ssh/known_hosts 2>/dev/null
- git clone ssh://giteajim@git.2martens.de:22/2martens/repo.git .
- git checkout main
- name: update index file
image: alpine/helm:3.12.3
commands:
- ./scripts/generate-index.sh
- name: save modified index file
image: alpine/git
environment:
SSH_KEY:
from_secret: private_ssh_key
commands:
- mkdir $HOME/.ssh
- echo "$SSH_KEY" > $HOME/.ssh/id_ed25519
- chmod 600 $HOME/.ssh/id_ed25519
- touch $HOME/.ssh/known_hosts
- chmod 600 $HOME/.ssh/known_hosts
- ssh-keyscan -H git.2martens.de > $HOME/.ssh/known_hosts 2>/dev/null
- git add charts/index.yaml
- git diff-index --quiet HEAD || git commit -m "[Drone] Updated index.yaml [CI SKIP]"
- git push origin main
- name: prepare deployed files
image: alpine
commands:
- mkdir deploy
- cp -R .htaccess charts files deploy
- name: deploy
pull: always
image: 2martens/drone-rsync
settings:
hosts: [ "shaula.uberspace.de" ]
user: wahlback
source: /drone/src/deploy/.
target: ~/tmp/build
recursive: true
delete: true
port: 22
key:
from_secret: private_ssh_key
script:
- shopt -s dotglob
- rm -rf html/*
- cp -r tmp/build/* html/
- rm -rf tmp/build
trigger:
branch:
- main