You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

147 lines
4.2 KiB

kind: pipeline
type: kubernetes
name: release
trigger:
branch:
- master
- develop
steps:
- name: submodules
image: alpine/git
commands:
- git submodule update --recursive --remote --init
- name: resume
image: registry.hkoerber.de/latex:eeb99822662d55f870bd99e2b52c0c8f7a2f4615
commands:
- cd contrib/resume
- pdflatex -halt-on-error -output-format pdf -interaction errorstopmode -draftmode resume.tex
- pdflatex -halt-on-error -output-format pdf -interaction errorstopmode -draftmode resume.tex
- pdflatex -halt-on-error -output-format pdf -interaction errorstopmode resume.tex
- name: resume-html
image: registry.hkoerber.de/pdf2htmlex:65507e872f79c29dfde25f83d3f0666617ee1c5f
commands:
- cd contrib/resume
- >-
pdf2htmlEX
--fit-width 1024
--embed cfijo
--dest-dir html-out
--embed-external-font 1
resume.pdf
index.html
- name: gather-assets
image: alpine
commands:
- cp contrib/resume/resume.pdf static/assets/resume/Hannes_Koerber_Resume.pdf
- cp -r contrib/resume/html-out static/assets/resume-html
- name: production:build
when:
branch:
- master
image: docker.io/klakegg/hugo:0.82.0-alpine
commands:
- >-
hugo
--baseURL=https://blog.hkoerber.de/
--cleanDestinationDir
--minify
--environment production
--destination ./public/
- chmod -R o+rX ./public/
- name: preview:build
image: docker.io/klakegg/hugo:0.82.0-alpine
when:
branch:
- develop
commands:
- >-
hugo
--baseURL=https://preview.blog.hkoerber.de/
--cleanDestinationDir
--minify
--buildDrafts
--buildFuture
--environment preview
--destination ./public/
- chmod -R o+rX ./public/
- name: production:image
image: registry.hkoerber.de/drone-kaniko:latest
when:
branch:
- master
settings:
dockerfile: Dockerfile.nginx
registry: registry.hkoerber.de
repo: blog
tags:
- ${DRONE_COMMIT_SHA}
- name: preview:image
image: registry.hkoerber.de/drone-kaniko:latest
when:
branch:
- develop
settings:
dockerfile: Dockerfile.nginx
registry: registry.hkoerber.de
repo: blog
tags:
- ${DRONE_COMMIT_SHA}-preview
- name: production:update k8s
image: alpine/git
when:
branch:
- master
commands:
# the explicit setting of the env variables is required because drone does
# not "export" the environment variables set with "environment:", they are
# only usable inside the scripts.
- export GIT_AUTHOR_NAME="Drone"
- export GIT_AUTHOR_EMAIL="drone@hkoerber.de"
- export GIT_COMMITTER_NAME="$$GIT_AUTHOR_NAME"
- export GIT_COMMITTER_EMAIL="$$GIT_AUTHOR_EMAIL"
- git clone https://code.hkoerber.de/hannes/mycloud mycloud
- cd mycloud/k8s/manifests/blog
- "sed -i 's#image: registry.hkoerber.de/blog:.*$#image: registry.hkoerber.de/blog:${DRONE_COMMIT_SHA}#' 50-deployment.yaml"
# Check if file actually changed, we're done if it did not. Most likely a
# pipeline re-run
- git diff --exit-code --quiet -- 50-deployment.yaml && exit 0 || true
- git add 50-deployment.yaml
- >-
git commit
-m 'k8s: Update blog container image'
-m "Triggered in repo $DRONE_REPO by commit $DRONE_COMMIT"
- git push origin master
- name: preview:update k8s
image: alpine/git
when:
branch:
- develop
commands:
# the explicit setting of the env variables is required because drone does
# not "export" the environment variables set with "environment:", they are
# only usable inside the scripts.
- export GIT_AUTHOR_NAME="Drone"
- export GIT_AUTHOR_EMAIL="drone@hkoerber.de"
- export GIT_COMMITTER_NAME="$$GIT_AUTHOR_NAME"
- export GIT_COMMITTER_EMAIL="$$GIT_AUTHOR_EMAIL"
- git clone https://code.hkoerber.de/hannes/mycloud mycloud
- cd mycloud/k8s/manifests/blog-preview
- "sed -i 's#image: registry.hkoerber.de/blog:.*$#image: registry.hkoerber.de/blog:${DRONE_COMMIT_SHA}-preview#' 50-deployment.yaml"
# Check if file actually changed, we're done if it did not. Most likely a
# pipeline re-run
- git diff --exit-code --quiet -- 50-deployment.yaml && exit 0 || true
- git add 50-deployment.yaml
- >-
git commit
-m 'k8s: Update blog preview container image'
-m "Triggered in repo $DRONE_REPO by commit $DRONE_COMMIT"
- git push origin master