Dan Anglin
0dac49356c
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.
131 lines
3 KiB
YAML
131 lines
3 KiB
YAML
---
|
|
#--------------------------------------------#
|
|
# Hidden job templates for CV build pipeline #
|
|
#--------------------------------------------#
|
|
.use-cv-builder:
|
|
image: ${IMAGE_NAME}:master-cb8a29c7
|
|
|
|
.cv-default-job-rules:
|
|
rules:
|
|
- when: always
|
|
|
|
.cv-publish-job-rules:
|
|
rules:
|
|
- if: '$CI_COMMIT_REF_NAME =~ /^[0-9]{4}(.[0-9]{2}){2}$/ && $CI_PROJECT_PATH == "dananglin/cv"'
|
|
when: always
|
|
|
|
.default-tags:
|
|
tags:
|
|
- dananglin-general
|
|
|
|
.release-tags:
|
|
tags:
|
|
- dananglin-cv-release
|
|
|
|
#------------------------------------#
|
|
# Visible jobs for CV build pipeline #
|
|
#------------------------------------#
|
|
test:spellcheck:
|
|
before_script:
|
|
- apt-get update
|
|
- apt-get -y install aspell aspell-en
|
|
extends:
|
|
- .cv-default-job-rules
|
|
- .default-tags
|
|
- .use-cv-builder
|
|
script:
|
|
- go run mage.go spellcheck
|
|
stage: test
|
|
|
|
test:pdf:
|
|
extends:
|
|
- .cv-default-job-rules
|
|
- .default-tags
|
|
- .use-cv-builder
|
|
script:
|
|
- go run mage.go pdf
|
|
stage: test
|
|
|
|
build:pdf:
|
|
artifacts:
|
|
expire_in: "30 minutes"
|
|
paths:
|
|
- __output/cv.pdf
|
|
extends:
|
|
- .default-tags
|
|
- .use-cv-builder
|
|
needs:
|
|
- job: "test:spellcheck"
|
|
artifacts: false
|
|
- job: "test:pdf"
|
|
artifacts: false
|
|
rules:
|
|
- if: '$CI_MERGE_REQUEST_IID'
|
|
when: always
|
|
script:
|
|
- go run mage.go pdf
|
|
stage: build
|
|
|
|
build:pdf-for-publish:
|
|
artifacts:
|
|
expire_in: "1 year"
|
|
name: cv-DanAnglin-${CI_COMMIT_REF_NAME}
|
|
paths:
|
|
- ${RELEASE_CV_FILENAME}
|
|
- build_job_id
|
|
extends:
|
|
- .cv-publish-job-rules
|
|
- .default-tags
|
|
- .use-cv-builder
|
|
needs:
|
|
- job: "test:spellcheck"
|
|
artifacts: false
|
|
- job: "test:pdf"
|
|
artifacts: false
|
|
script:
|
|
- go run mage.go pdf
|
|
- mv __output/cv.pdf ${RELEASE_CV_FILENAME}
|
|
- echo "${CI_JOB_ID}" > build_job_id
|
|
stage: build
|
|
|
|
publish:pdf:online:
|
|
before_script:
|
|
- export BUILD_JOB_ID=$( cat build_job_id )
|
|
extends:
|
|
- .cv-publish-job-rules
|
|
- .release-tags
|
|
image: registry.gitlab.com/gitlab-org/release-cli:v0.3.0
|
|
needs:
|
|
- job: "build:pdf-for-publish"
|
|
artifacts: true
|
|
script:
|
|
- 'echo "Publishing CV for release ${CI_COMMIT_REF_NAME}"'
|
|
- >
|
|
release-cli create --name "CV - ${CI_COMMIT_REF_NAME}"
|
|
--description "CV published with the release-cli tool for version ${CI_COMMIT_REF_NAME}"
|
|
--tag-name "${CI_COMMIT_REF_NAME}"
|
|
--ref "${CI_COMMIT_REF_NAME}"
|
|
--assets-links-name "${RELEASE_CV_FILENAME}"
|
|
--assets-links-url "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/jobs/${BUILD_JOB_ID}/artifacts/${RELEASE_CV_FILENAME}"
|
|
stage: "publish"
|
|
variables:
|
|
GIT_STRATEGY: "none"
|
|
|
|
# Private releases rebuilds the CV with the extra details.
|
|
publish:pdf:private:
|
|
extends:
|
|
- .cv-publish-job-rules
|
|
- .release-tags
|
|
- .use-cv-builder
|
|
needs:
|
|
- job: "test:spellcheck"
|
|
artifacts: false
|
|
- job: "test:pdf"
|
|
artifacts: false
|
|
script:
|
|
- go run mage.go pdf
|
|
- mv __output/cv.pdf ${CV_DEPLOY_DIR}/${RELEASE_CV_FILENAME}
|
|
stage: publish
|
|
variables:
|
|
CV_DEPLOY_DIR: "/CV"
|
|
CV_CONTACT_PHONE: $RELEASE_CV_CONTACT_PHONE
|