ci: add resume releases

This commit is contained in:
Price Hiller 2023-09-13 16:55:38 -05:00
parent a5d84d1ac5
commit da0df72a5c
No known key found for this signature in database

View File

@ -1,13 +1,81 @@
image: "alpine:latest"
stages:
- tectonic-run
- 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"
# TODO: Cache curl installs and tectonic, for now this works, but is not performant
tectonic-run:
stage: tectonic-run
build:
stage: build
image: alpine:latest
script:
- apk update && apk upgrade && 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
- ./tectonic -X compile --keep-logs ./resume.tex
artifacts:
paths:
- "${RESUME_FILE}"
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}'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "${RESUME_FILE}" ${PACKAGE_REGISTRY_URL}/latest/${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_MESSAGE}"
ref: "${CI_COMMIT_SHA}"
assets:
links:
- name: "${RESUME_FILE}"
url: "${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/${RESUME_FILE}"
remove-latest-release:
stage: release
needs:
- upload
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- echo "Removing current latest tag"
- 'curl --request DELETE --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases/latest"'
latest-release:
stage: release
needs:
- remove-latest-release
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- echo "Releasing Resume @ latest"
rules:
- if: $CI_COMMIT_TAG
release:
tag_name: latest
description: "${CI_COMMIT_TAG_MESSAGE}"
ref: "${CI_COMMIT_SHA}"
assets:
links:
- name: "${RESUME_FILE}"
url: "${PACKAGE_REGISTRY_URL}/latest/${RESUME_FILE}"