Resume/.gitlab-ci.yml

78 lines
2.2 KiB
YAML
Raw Normal View History

2023-09-13 06:36:08 -05:00
stages:
2023-09-13 16:55:38 -05:00
- build
- upload
- release
variables:
PACKAGE_VERSION: "$CI_COMMIT_TAG"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/resume"
RESUME_FILE: "resume.pdf"
2023-09-13 06:36:08 -05:00
# TODO: Cache curl installs and tectonic, for now this works, but is not performant
2023-09-13 16:55:38 -05:00
build:
stage: build
image: alpine:latest
2023-09-13 21:09:22 -05:00
variables:
TECTONIC_DEPS_CACHE_PATH: "${CI_PROJECT_DIR}/.cache/Tectonic"
TECTONIC_BIN_CACHE_PATH: "${CI_PROJECT_DIR}/tectonic"
cache:
policy: pull-push
when: on_success
paths:
- "${TECTONIC_DEPS_CACHE_PATH}"
- "${TECTONIC_BIN_CACHE_PATH}"
script: |
mkdir -p "${CI_PROJECT_DIR}/.cache"
mkdir -p "${HOME}/.cache"
if [ -r "${TECTONIC_DEPS_CACHE_PATH}" ]; then
mv "${TECTONIC_DEPS_CACHE_PATH}" "${HOME}/.cache"
fi
if ! [ -x ./tectonic ]; then
echo "Cache miss, tectonic binary not in cache! Redownloading!"
apk update
apk add curl
curl -L0 https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%400.14.1/tectonic-0.14.1-x86_64-unknown-linux-musl.tar.gz --output tectonic.tar.gz
tar -xf tectonic.tar.gz
fi
echo "Compiling resume!"
./tectonic -X compile --keep-logs ./resume.tex
echo "Finished compiling resume, saving caches"
mv "${HOME}/.cache/Tectonic" "${CI_PROJECT_DIR}/.cache/Tectonic"
2023-09-13 16:55:38 -05:00
artifacts:
2023-09-13 21:09:22 -05:00
expire_in: 1 week
2023-09-13 16:55:38 -05:00
paths:
- "${RESUME_FILE}"
2023-09-13 21:09:22 -05:00
2023-09-13 16:55:38 -05:00
upload:
stage: upload
needs:
- build
rules:
- if: $CI_COMMIT_TAG
image: curlimages/curl:latest
script:
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "${RESUME_FILE}" ${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/${RESUME_FILE}'
tag-release:
stage: release
needs:
- upload
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- echo "Releasing Resume @ ${CI_COMMIT_TAG}"
rules:
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != "latest"
release:
tag_name: "${CI_COMMIT_TAG}"
description: "${CI_COMMIT_TAG}"
2023-09-13 16:55:38 -05:00
ref: "${CI_COMMIT_SHA}"
assets:
links:
- name: "${RESUME_FILE}"
url: "${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/${RESUME_FILE}"
2023-09-13 20:49:47 -05:00
filepath: /resume.pdf
link_type: other