Skip to content

Commit 93d0e78

Browse files
committed
chore(drone): use drone replace travis
1 parent 10dd23f commit 93d0e78

4 files changed

Lines changed: 90 additions & 10 deletions

File tree

.drone/drone.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
kind: pipeline
2+
type: docker
3+
name: default
4+
5+
steps:
6+
- name: build-docs
7+
image: docker.io/library/docker:dind
8+
privileged: true
9+
commands:
10+
- nohup dockerd &
11+
- apk add make bash curl git
12+
- make docker-build docker-build-docs
13+
- cd _build/html && echo "www.drycc.cc" > CNAME && git init
14+
environment:
15+
SSH_DEPLOY_KEY:
16+
from_secret: ssh_deploy_key
17+
when:
18+
event:
19+
- push
20+
- tag
21+
22+
- name: publish-docs
23+
image: appleboy/drone-git-push
24+
pull: if-not-exists
25+
settings:
26+
branch: main
27+
remote: git@github.com:drycc/www.drycc.cc.git
28+
path: _build/html
29+
force: true
30+
commit: true
31+
commit_message: init repo
32+
ssh_key:
33+
from_secret: ssh_deploy_key
34+
when:
35+
event:
36+
- push
37+
- tag
38+
39+
- name: publish-charts
40+
image: docker.io/drycc/python-dev
41+
privileged: true
42+
commands:
43+
- pip install -r requirements.txt
44+
- python _scripts/dependency_update.py "$CHARTMUSEUM_API/$([ -z $DRONE_TAG ] && echo testing || echo stable)" "charts/workflow/requirements.yaml"
45+
- helm package charts/workflow -u --version ${DRONE_TAG:-v1.0.0}
46+
- curl -u $CHARTMUSEUM_USERNAME:$CHARTMUSEUM_PASSWORD -F chart=@workflow-${DRONE_TAG:-v1.0.0}.tgz "$CHARTMUSEUM_API/api/$([ -z $DRONE_TAG ] && echo testing || echo stable)/charts"
47+
environment:
48+
CHARTMUSEUM_API:
49+
from_secret: chartmuseum_api
50+
CHARTMUSEUM_USERNAME:
51+
from_secret: chartmuseum_username
52+
CHARTMUSEUM_PASSWORD:
53+
from_secret: chartmuseum_password
54+
when:
55+
event:
56+
- push
57+
- tag
58+

.travis.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

_scripts/dependency_update.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import sys
2+
import yaml
3+
import requests
4+
from contextlib import closing
5+
6+
7+
def load_index(url):
8+
with closing(requests.get(url)) as response:
9+
return yaml.load(response.text, Loader=yaml.Loader)
10+
11+
def load_requirements(requirements_file):
12+
with open(requirements_file) as f:
13+
return yaml.load(f, Loader=yaml.Loader)
14+
15+
def dump_requirements(requirements_file, requirements):
16+
with open(requirements_file, "w") as f:
17+
return yaml.dump(requirements, stream=f, Dumper=yaml.Dumper)
18+
19+
def update_dependencies(index, requirements, url):
20+
for dependency in requirements["dependencies"]:
21+
entries = index["entries"][dependency["name"]]
22+
entries.sort(key=lambda x: x["created"])
23+
dependency["version"] = entries[-1]["version"]
24+
dependency["repository"] = url
25+
26+
if __name__ == "__main__":
27+
index = load_index(sys.argv[1] + "/index.yaml")
28+
requirements = load_requirements(sys.argv[2])
29+
update_dependencies(index, requirements, sys.argv[1])
30+
dump_requirements(sys.argv[2], requirements)
31+

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
mkdocs==1.0.4
2+
PyYaml==5.4.1
23
markdown-checklist==0.4.1
34
markdown-include==0.5.1

0 commit comments

Comments
 (0)