我使用 CircleCI 和 GameCI docker 镜像来构建 Unity 项目。构建工作正常,但我正在尝试使用
h-matsuo/github-release
orb 以便在 GitHub 上为该构建创建一个版本。我为此创建了一个新的单独作业,因此我需要在作业之间共享数据。我正在使用 persist_to_workspace
来执行此操作,如文档中所指定,但该解决方案似乎不起作用。我收到以下错误:
无法确保工作区目录 /root/project/Zipped 存在
对于工作区持久逻辑,我在我的
config.yml
文件中添加了以下代码行:
working_directory: /root/project
- 主要工作的执行者内部persist_to_workspace
- 作为我主要工作步骤中的最后一个命令attach_workspace
- 作为我第二份工作步骤中的开始命令这是我的完整
config.yml
文件:
version: 2.1
orbs:
github-release: h-matsuo/[email protected]
executors:
unity_exec:
docker:
- image: unityci/editor:ubuntu-2019.4.19f1-windows-mono-0.9.0
environment:
BUILD_NAME: speedrun-circleci-build
working_directory: /root/project
.build: &build
executor: unity_exec
steps:
- checkout
- run: mkdir -p /root/project/Zipped
- run:
name: Git submodule recursive
command: git submodule update --init --recursive
- run:
name: Remove editor folder in shared project
command: rm -rf ./Assets/Shared/Movement/Generic/Attributes/Editor/
- run:
name: Converting Unity license
command: chmod +x ./ci/unity_license.sh && ./ci/unity_license.sh
- run:
name: Building game binaries
command: chmod +x ./ci/build.sh && ./ci/build.sh
- run:
name: Zipping build
command: apt update && apt -y install zip && zip -r "/root/project/Zipped/build.zip" ./Builds/
- store_artifacts:
path: /root/project/Zipped/build.zip
- run:
name: Show all files
command: find "$(pwd)"
- persist_to_workspace:
root: Zipped
paths:
- build.zip
jobs:
build_windows:
<<: *build
environment:
BUILD_TARGET: StandaloneWindows64
release:
description: Build project and publish a new release tagged `v1.1.1`.
executor: github-release/default
steps:
- attach_workspace:
at: /root/project/Zipped
- run:
name: Show all files
command: sudo find "/root/project"
- github-release/create:
tag: v1.1.1
title: Version v1.1.1
description: This release is version v1.1.1.
file-path: ./build.zip
workflows:
version: 2
build:
jobs:
- build_windows
- release:
requires:
- build_windows
我可以尝试什么来解决这个问题?
如果有人遇到同样的问题,请尽量避免使用
/root
路径。我已将工件存储在 /tmp/
内部的某处,并且在存储工件之前,我已使用 chmod 777
手动创建了文件夹,方法是使用 mkdir
和 -m
标志来指定 chmod 权限。