无人机 ci 发布生成的乳胶 pdf

drone ci publish generated latex pdf

其实我在用travis,但是我想换成drone。

对于所有 tex 文档,我使用带有容器的小型 Makefile 来生成我的 pdf 文件并将其部署到我的存储库中。

但是因为我使用的是 gitea,所以我想设置我的无人机集成管道,但我不知道如何配置 .drone.yml 来部署我的 pdf 文件每个标签都会发布。

实际上我正在使用以下 .drone.yml 我很高兴地说,构建过程目前运行良好。

clone:
  git:
    image: plugins/git
    tags: true

pipeline:
  pdf:
    image: volkerraschek/docker-latex:latest
    pull: true
    commands:
    - make

这是我的 Makefile

# Docker Image
IMAGE := volkerraschek/docker-latex:latest

# Input tex-file and output pdf-file
FILE := index
TEX_NAME := ${FILE}.tex
PDF_NAME := ${FILE}.pdf

latexmk:
    latexmk \
        -shell-escape \
        -synctex=1 \
        -interaction=nonstopmode \
        -file-line-error \
        -pdf ${TEX_NAME}

docker-latexmk:
    docker run \
        --rm \
        --user="$(shell id -u):$(shell id -g)" \
        --net="none" \
        --volume="${PWD}:/data" ${IMAGE} \
        make latexmk

当我推送一个新的 git 标签时,我的 drone.yml 中缺少哪些标签和条件来部署我的 index.pdf 作为 gitea 中的发布?

沃尔克

我在我的 gitea / drone 对上有这个设置。这是我的 .drone.yml:

的 MWE
pipeline:
  build:
    image: tianon/latex
    commands:
      - pdflatex <filename.tex>
  gitea_release:
    image: plugins/gitea-release
    base_url: <gitea domain>
    secrets: [gitea_token]
    files: <filename.pdf>
    when:
      event: tag

因此,我们没有在 Makefile 中设置 docker 构建,而是添加了一个使用 docker image with latex 的步骤,编译 pdf,并使用管道步骤发布.

您还必须设置您的无人机仓库以触发标签上的构建并设置要使用的 gitea API 令牌。要设置 API 令牌,您可以使用命令行界面:

$ drone secret add <org/repo> --name gitea_token --value <token value> --image plugins/gitea-release

您可以设置无人机存储库以在网络存储库设置中触发构建 UI。

请注意,您可能还必须在 gitea 设置中允许 *.pdf 附件,因为它们在默认情况下是不允许的。在您的 gitea app.ini 中将此添加到附件部分:

[attachment]
ENABLED = true
PATH = /data/gitea/attachments
MAX_SIZE = 10
ALLOWED_TYPES = */*

除了 Gabe 的回答之外,如果您使用的是 NGINX 反向代理,您可能还必须允许在 nginx.conf 中上传更大的文件。 (这适用于所有文件类型,而不仅仅是 .pdf)

server {

  [ ... ]

  location / {
    client_max_body_size 10M;      # add this line
    proxy_pass http://gitea:3000;
  }

}

这解决了我的问题。