CV/.gitlab/ci/docker-gitlab-ci.yml
Dan Anglin 0dac49356c
ci: add a release pipeline
This commit adds a release pipeline for publishing my CV online to the project's
release page and also privately to a mounted volume on my personal machine.
The release pipeline is triggered for every tagged commit that uses the date
versioning scheme (e.g. 2021.09.21).

Changes include:

- added tags to all jobs so private runners are used.
- added a build stage.
- added a build job to build the CV for merge requests.
- added a build job to build the CV for the release pipeline.
- the build job for the release pipeline adds the CV to an artifacts that expire after 1 year.
- created a publish job for publishing the CV online to the project's release page.
- created a publish job for publishing the CV privately to a mounted volume on the private runner.
- small updates in the README.
- removed the CV file from the repository.
- removed the job that publishes the CV PDF file to the master branch.
2020-08-15 20:22:00 +01:00

68 lines
1.5 KiB
YAML

---
#--------------------------------------------------------#
# Hidden job templates for Docker build/publish pipeline #
#--------------------------------------------------------#
.docker-build-setup:
image: docker:19.03.12
services:
- docker:19.03.12-dind
before_script:
- apk add --no-cache go
.dockerfile-lint:
stage: test
image: hadolint/hadolint:v1.18.0-alpine
script:
- "hadolint docker/Dockerfile"
.dockerbuild-test:
stage: test
extends: .docker-build-setup
.docker-test-rules:
rules:
- if: '$CI_COMMIT_BRANCH'
changes:
- "docker/Dockerfile"
when: always
- if: '$CI_COMMIT_REF_NAME =~ /^[0-9]{4}(.[0-9]{2}){2}$/'
when: never
.docker-publish-pre-post:
stage: publish
extends: .docker-build-setup
before_script:
- apk add --no-cache go
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
after_script:
- docker logout ${CI_REGISTRY}
.docker-publish-rules:
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_PATH == "dananglin/cv"'
changes:
- "docker/Dockerfile"
when: always
#------------------------------------------------#
# Visible jobs for Docker build/publish pipeline #
#------------------------------------------------#
test:dockerfile:lint:
extends:
- .dockerfile-lint
- .docker-test-rules
test:docker:build:
extends:
- .dockerbuild-test
- .docker-test-rules
script:
- go run mage.go image
publish:docker-image:
extends:
- .docker-publish-pre-post
- .docker-publish-rules
script:
- go run mage.go publishImage